I have a problem where I can't do my vagrant up in cygwin, because cygwin can't understand non-POSIX style paths like C:\, which the vagrantfile uses.

I use git-bash to start vagrant, because it can understand the non-POSIX paths. To make my life even simpler, I created windows .lnk files to launch bash scripts in git-bash that start my ssh agent and start vagrant.

I wanted it to take a step further and use bash aliases in cygwin to create an alias for vagrant up that would launch my vagrant-up.lnk, etc, which in turn would launch a git-bash session and finally start my vagrant instance.

However, I am having a strange problem where I cannot launch .lnk files with cygwin nor git-bash.

$ cygstart vagrant-up.lnk
Unable to start 'vagrant-up.lnk': The specified path was not found.

Thinking it was a path issue, I tried giving the full path:

$ cygstart -o /cygdrive/c/Documents\ and\ Settings/user/Desktop/vagrant-up.lnk
Unable to start 'C:\Documents and Settings\user\Desktop\vagrant-up.lnk': The operating system denied access to the specified file.

The error message seems more useful in git-bash

MINGW64 /c/Users/user/Desktop
$ ./vagrant-up.lnk
bash: ./vagrant-up.lnk: cannot execute binary file: Exec format error

I googled the "bash cannot execute binary file" error, but only found results about *nix utilities compiled for the wrong architecture (e.g. AIX on x86, etc)

On Timothy Martin's suggestion, I also tried this, to no avail:

$ cygstart /cygdrive/c/Users/user/Desktop/vagrant-up.lnk
Unable to start 'C:\Users\user\Desktop\vagrant-up.lnk': The specified path was not found.

It is interesting that it uses windows-style paths in this error message, but I don't know how to turn that fact into a resolution of my problem.

In the vagrant-up.lnk, the Target: is "C:\Program Files\Git\git-bash.exe" -l "C:\cygwin\home\user\vagrant\scripts\vagrant-up.git-bash" and Start in: is in "C:\Program Files\Git".

What do I need to do to launch these .lnk files from cygwin? They run just fine when I double-click them in Windows.

  • For vagrant-up.lnk have you tried cygstart /cygdrive/c/Users/user/Desktop/vagrant-up.lnk? – Timothy Martin Feb 8 '17 at 22:15
  • @TimothyMartin Just tried it; same results. I updated my question. – user394 Feb 9 '17 at 4:43
  • cygstart vagrant-up.bash search for a program associated to .bash extension and find nothing on windows extension database . Try just vagrant-up.bash . Additional, have you put #!/bin/bash at the beginning of the script ? – matzeri Feb 9 '17 at 7:05
  • @matzeri I mistakenly referenced my vagrant-up.bash script that git-bash uses. I am trying to launch my vagrant-up.lnk windows shortcut through cygwin. I have updated my question; sorry for the confusion. – user394 Feb 9 '17 at 14:23
  • cygstart with a *.lnk file works for me. How have you defined the Target and the Start in of your windows link ? – matzeri Feb 9 '17 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.