[Mono-list] ProcessStartInfo and arguments with a backslash

Robert Jordan robertj at gmx.net
Sat Oct 1 14:49:17 EDT 2011

On 01.10.2011 20:17, Yves Goergen wrote:
> Hi,
> I am debugging a problem with my .NET application calling a UNIX
> programme with arguments. The bash command line looks like this:
>     /usr/bin/smem -P '/usr/sbin/exim4(\s|$)'
> My C# code to do exactly that is the following:
>     string processPath = "/usr/sbin/exim4(\s|$)";

No, it isn't ;) '\s' is not a known escape (it won't even compile).

You need to escape the '\' with a '\':

string processPath = "/usr/sbin/exim4(\\s|$)";


More information about the Mono-list mailing list