X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-5.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org X-IronPortListener: Outbound_SMTP X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EAAWKH1CcKEcW/2dsb2JhbABFuT6BB4IgAQEBBBJ3AgEIDQEDBAEBHRIfExcBBQgBAQQBGhqHa55wnDyLSoYkYAOIGIR+jjCKD4J7 From: "Buchbinder, Barry (NIH/NIAID) [E]" To: John Wiersba , "cygwin AT cygwin DOT com" Date: Mon, 6 Aug 2012 05:15:25 -0400 Subject: RE: Cygstart bug: doesn't keep command line arguments intact Message-ID: <0105D5C1E0353146B1B222348B0411A20A954E0E15@NIHMLBX02.nih.gov> References: <1344017509 DOT 70947 DOT YahooMailNeo AT web161502 DOT mail DOT bf1 DOT yahoo DOT com> <1344020282 DOT 97348 DOT YahooMailNeo AT web161504 DOT mail DOT bf1 DOT yahoo DOT com>,<1344021535 DOT 36623 DOT YahooMailNeo AT web161501 DOT mail DOT bf1 DOT yahoo DOT com> <0105D5C1E0353146B1B222348B0411A20A954E0E13 AT NIHMLBX02 DOT nih DOT gov>,<1344217063 DOT 51063 DOT YahooMailNeo AT web161502 DOT mail DOT bf1 DOT yahoo DOT com> In-Reply-To: <1344217063.51063.YahooMailNeo@web161502.mail.bf1.yahoo.com> Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 X-IsSubscribed: yes 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 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q769GHrV004998 John Wiersba wrote on August 05, 2012 9:37 PM >I would think that cygstart should pass arg1 as arg1 to the specified command (winword.exe in my example). That's certainly the way it works in the unix/linux world and cygstart should be considered as an (emulated) unix command, right? If cygstart were a Windows command I would expect such behavior, but from an (emulated) unix/linux command, I expect the arguments to be kept intact. >In any case, it makes it awkward to run the command I mentioned, because I have to parse the arguments myself and perform awkward substitutions on them. Have you considered the following? cygstart "a b c.doc" Unless you've reset the default application for doc files, Windows will see the doc file extension and pass the file to winword. And the following might even work (untested), which lets one take advantage of file name completion. cygstart a\ b\ c.doc Or how about a script? (untested) #!/bin/bash for WrdDoc in "$@"; do cygstart /path/winword.exe "\"${WrdDoc}\"" ; done Unrelated: Not that I mind, but this list is very anti-top-posting. you are forewarned. - Barry Disclaimer: Statements made herein are not made on behalf of NIAID. ________________________________ From: "Buchbinder, Barry (NIH/NIAID) [E]" Sent: Sunday, August 5, 2012 2:38 PM Subject: RE: Cygstart bug: doesn't keep command line arguments intact John Wiersba wrote August 03, 2012 3:18 PM >Calling /c/program\ files/microsoft\ office/office12/winword.exe "a b c.doc" works. >Calling cygstart /c/program\ files/microsoft\ office/office12/winword.exe "a b c.doc" tries to open a.doc, b.doc, and c.doc. In the first, bash strips the quotes and passes to winword as arg1. In the second, bash strips the quotes and passes to cygstart as arg1. cygstart then passes , , and to winword as arg1, arg2, and arg3. At least that is the way I understand it. Subject to correction by the more knowledgeable. So try protecting your double quotes with single quotes. E.g. '"a b c.doc"'. I don't know if the double quotes get passed to winword, but there is a lesser chance that single quotes will work if they are on the inside, I doubt MS ever treats them as special. Good luck. - Barry Disclaimer: Statements made herein are not made on behalf of NIAID. -- 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