This is the mail archive of the
mailing list for the Cygwin project.
Re: Formatting command line arguments when starting a Cygwin process from a native process
- From: Erik Soderquist <ErikSoderquist at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Thu, 5 May 2016 12:47:07 -0400
- Subject: Re: Formatting command line arguments when starting a Cygwin process from a native process
- Authentication-results: sourceware.org; auth=none
- References: <005c01d1a6e2$30270ba0$907522e0$ at metastack dot com>
On Thu, May 5, 2016 at 11:24 AM, David Allsopp wrote:
> I am trying to work out the precise details for character escaping when
> starting a Cygwin process from a native (i.e. non-Cygwin) Windows process.
> For example:
> argv = "foo"
> argv = "bar baz"
> then the resulting command line string should be:
> lpCommandLine = "foo bar\" \"baz"
If I recall correctly, Windows cmd.exe uses the carrot (^) as the
general escape from shell character, so
C:\cygwin64\bin>.\echo.exe -e ^"hello\nworld^"
However, I've found Windows's interpretation to be inconsistent, so
often have to play with it to find what the "right combination" is for
a particular instance.
I find echoing the parameters to a temporary text file and then using
the file as input to be more reliable and easier to troubleshoot, and
it breaks apart whether it is Windows cli inconsistencies or receiving
program issues very nicely with the text file content as an
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple