X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:references :in-reply-to:content-type:content-transfer-encoding :mime-version; q=dns; s=default; b=mXpch5EsA5Qi/nrD3DuJfe2MaISvo 35VCAamag51IfiBUzUW4nfu+w9t54ojBsNgItEQVZArUAJTBSybRQaU6iCy5h4qi m9byXoXY0ig7RsViid7uFzNx3nfVZHG4YBfuwHxQhIcKyJ9twhZnriBufxLy3Hih QRyZVXIlnAns3k= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:references :in-reply-to:content-type:content-transfer-encoding :mime-version; s=default; bh=KsTHltfe2/U7elKfIiEecTVKYaw=; b=mlt BSK1RSr486rWISnSpSFcs/YgvrjwWioNd7BTxF8FtFFze/cyseE2fV5pFcDUNwTJ QDvKiBZ5MaJug4c+Pud3TghWycwbjJPVDUSGARt01iR1PmxASaWxv7toS2Z3DBfp RAKuFw02jG4Fk7Jif8IXbExDjPM+40SZSYUvRepU= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=H*M:local, H*RU:14.03.0361.001, Hx-spam-relays-external:14.03.0361.001, H*r:14.03.0361.001 X-HELO: outmail148113.authsmtp.com From: David Allsopp To: "cygwin AT cygwin DOT com" Subject: RE: How to start Cygwin from outside Cygwin and pass a command to execute? Date: Fri, 2 Feb 2018 09:16:42 +0000 Message-ID: References: <4df6f54b-5898-76f9-ebf6-1a2e40c65aa5 AT yahoo DOT co DOT uk> In-Reply-To: <4df6f54b-5898-76f9-ebf6-1a2e40c65aa5@yahoo.co.uk> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-Server-Quench: ca3bf167-07f9-11e8-8106-0015176ca198 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCd1ZAARAlZ5RRob BmUtCCtbTh09DhZI RxQKKE1TKxwUVhJa I0lFL1x7O0wTWlBf HTVUBhpUUkIHDDFq aQpQZRVda0BPWQ9u VQZLQ1FMFQVtHx4A BAAfUx1tdQBZeTA3 ZERrKSgyGUR9dkB+ RQBVHGoPKzQxazJJ UUZfagNTJgpXfx4Q Yk13VXMLfGUHZ39h QFE4NmlgbSNlBXYd YgYSZU4VCV0XFyQg DzsTEiouGwULXSI2 Zxs7NkUdEEtZGVQ9 LlonEVseP1cKAxZF V0gFCyhcIlAHS2I3 CmESUF4TGyBBTHA0 X-Authentic-SMTP: 61633634383431.1038:706 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 213.105.212.114/25 X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id w129HVbY016642 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