Web lists-archives.com

RE: How to start Cygwin from outside Cygwin and pass a command to execute?




Ben via cygwin wrote:
> Assume my CgyWin (on a windows 7) is currently NOT started.
> 
> Assume I want to call from Windows my CgyWin and pass a command to 
> execute.
> 
> Afterwards CygWin should automatically be closed again.
> 
> How can I achieve this?

C:\cygwin\bin\bash.exe -c "command"

You will find that successfully navigating the Command Prompt, Cygwin's and "bash -c"'s escaping rules to be entertaining for advanced commands.

You can also achieve similar with mintty.exe -e (which will launch the terminal emulator, instead of using an existing console window, or opening a new one). Similar fun with escaping unusual commands.

See, for example, https://github.com/ocaml/opam/blob/43e4c778/appveyor_build.cmd#L93


David


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple