Cygstart bug: doesn't keep command line arguments intact

Buchbinder, Barry (NIH/NIAID) [E]
Mon Aug 6 01:58:00 GMT 2012

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 <a b c.doc> to winword as arg1.

In the second, bash strips the quotes and passes <a b c.doc> to cygstart as arg1.
cygstart then passes <a>, <b>, and <c.doc> 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:
Unsubscribe info:

More information about the Cygwin mailing list