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

2018-02-04 Thread Andrey Repin
Greetings, Ben!

> Assume my CgyWin (on a windows 7) is currently NOT started.

This statement makes zero sense. "Cygwin" as is is a compatibility layer
(library), you can't "start" it separately from a program that uses it.

> Assume I want to call from Windows my CgyWin and pass a command to execute.

Just execute said command.

> Afterwards CygWin should automatically be closed again.

See above.

> How can I achieve this?

Just do it.


-- 
With best regards,
Andrey Repin
Sunday, February 4, 2018 23:50:13

Sorry for my terrible english...


--
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



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

2018-02-02 Thread Achim Gratz
Ben via cygwin writes:
> Assume I want to call from Windows my CgyWin and pass a command to execute.

That depends a bit on what kind of environment that command expects, but
it could be as easy as invoking it with the full path.  If it needs a
fully set up an environment you need to start a shell (dash or maybe
bash), perhaps in login mode to source your profile.  Lastly if it needs
a tty you'll want to start all that from mintty.

As others have commented, quoting all these commands correctly so they
are intact at the various stages of expansion can be quite an exercise
to get right, so it will be easier if you can wrap these things into a
script that doesn't need any arguments (or at least none that would need
quoting).


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Waldorf MIDI Implementation & additional documentation:
http://Synth.Stromeko.net/Downloads.html#WaldorfDocs

--
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



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

2018-02-02 Thread Brian Inglis
On 2018-02-02 01:31, 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?

Cygwin is a DLL providing Unix/POSIX facilities over the underlying Windows OS,
a collection of DLLs providing services using those facilities, and programs
using those services and facilities, following the Unix model of the OS
supporting libraries, services, and drivers, and managing hardware resources.
Cygwin is started when you run any program using those libraries, services, or
facilities.
Add the Cygwin bin directory to PATH in your User environment and you can run
Cygwin programs from the Win-R Run dialogue, any Windows shortcut, Scheduled
Task, Windows console shell: using Windows style exe paths with Unix command
parameters and Unix style file paths; or Cygwin terminal and shell using Unix
style commands.
Some users use Cygwin from the cmd shell, some from Powershell, others from
mintty or other terminals with bash, dash, or another Cygwin shell.

So just run the command from wherever you want; depending on what you want to
happen with the output, you may need a shell to redirect output, or a console
terminal to display output.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

--
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



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

2018-02-02 Thread David Allsopp
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