[Mono-devel-list] Arguments with spaces when starting external program through System.Diagnostics.Process
Sebastian Nowozin
nowozin at gmail.com
Sat May 21 21:56:04 EDT 2005
Hello everybody,
I try to use the System.Diagnostics.Process class on Debian with Mono
1.1.6, to execute an external program, which takes as first parameter
an absolute pathname. As I do not know anything about the pathname
except that it is a valid file, it may contain spaces.
I use Process.StartInfo.Arguments, which is of type string, to pass
the arguments. However, I discovered that the Mono implementation of
the Process class seems to act like a shell in that it splits the
arguments on whitespaces. I tried to escape spaces using '"' and "\
", with no success. (The attached program illustrates the problem.)
Hence, my question:
Is it possible to explicitly escape the arguments, or - alternatively
- a way to explicitly set each argument vector on its own? (like
argv[1], argv[2], etc.)
Regards,
Sebastian Nowozin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestProcess.cs
Type: text/x-csharp
Size: 1108 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050522/22f4c65e/attachment-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: exampleScript
Type: application/octet-stream
Size: 64 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050522/22f4c65e/attachment-0001.obj
More information about the Mono-devel-list
mailing list