public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: David Allsopp <David.Allsopp@cl.cam.ac.uk>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: RE: How to start Cygwin from outside Cygwin and pass a command to execute?
Date: Fri, 02 Feb 2018 09:17:00 -0000	[thread overview]
Message-ID: <E51C5B015DBD1348A1D85763337FB6D90189A625D5@Remus.metastack.local> (raw)
In-Reply-To: <4df6f54b-5898-76f9-ebf6-1a2e40c65aa5@yahoo.co.uk>

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

  reply	other threads:[~2018-02-02  9:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02  8:31 Ben via cygwin
2018-02-02  9:17 ` David Allsopp [this message]
2018-02-02 16:11 ` Brian Inglis
2018-02-02 19:18 ` Achim Gratz
2018-02-04 21:05 ` Andrey Repin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E51C5B015DBD1348A1D85763337FB6D90189A625D5@Remus.metastack.local \
    --to=david.allsopp@cl.cam.ac.uk \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).