Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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"
share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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