I need this for automated build configuration in Eclipse (long story). What I'm trying to figure out is the following. When invoking CMD from Run menu in Windows, one can do it as follows:

cmd /c CD "C:\Users\me\FolderWithExecutable" & executable.exe arg1 arg2

In other words, I can bring up the CMD window and execute a command in it, all from one line. Can I do the same thing with Cygwin? If I go to the Run menu (Windows+R), which is just a wrapper for a generalized Windows "run command" input, can I type in something like

C:\cygwin\bin\bash -SomeBashArgument cd "C:\Users\me\FolderWithBashScript" & script.sh arg1 arg2

or something similar, and make it do something analogous to what is done above with CMD?


Yes, something like

C:\cygwin\bin\bash -c "cd /cygdrive/c/Users/me/FolderWithBashScript" && script.sh arg1 arg2; read -p 'hit enter'"

If you need to have an interactive shell afterwards:

C:\cygwin\bin\bash -c "cd /cygdrive/c/Users/me/FolderWithBashScript" && script.sh arg1 arg2; bash --login -i"
  • I'm afraid it's not working. thanks what I tried initially as well, but as soon as I use the -c option, the window simply closes immediately. If I sun it from command prompt, it simply goes back to the system32 folder. – Phonon Oct 11 '11 at 21:11
  • @Phonon, updated answer. – glenn jackman Oct 11 '11 at 21:38

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.