file paths and verbatim literals problem

  • Thread starter Thread starter CroDude
  • Start date Start date
C

CroDude

Hi!

I have and issue with passing quoted path to a extern application via
Process.Start.
When I pass argument as:
@" -o c:\test.tif c:\_script.txt c:\test.jpg "

everything works fine but I have to pass paths in quotes ... it must look
like this:

-o "c:\test.tif " "c:\_script.txt" "c:\test.jpg "

so I write this:
@" -o ""c:\test.tif"" ""c:\_script.txt"" ""c:\test.jpg"" "

but output then looks like this:
" -o \"c:\\test.tif\" \"c:\\_script.txt\" \"c:\\test.jpg\" "

as You see I got double backshlashes and single backslashes on a places
where they shouldn't be.
Any suggestions .... I'm really stuck .... again!
Thanks!
 
CroDude said:
I have and issue with passing quoted path to a extern application via
Process.Start.
When I pass argument as:
@" -o c:\test.tif c:\_script.txt c:\test.jpg "

everything works fine but I have to pass paths in quotes ... it must look
like this:

-o "c:\test.tif " "c:\_script.txt" "c:\test.jpg "

so I write this:
@" -o ""c:\test.tif"" ""c:\_script.txt"" ""c:\test.jpg"" "

but output then looks like this:
" -o \"c:\\test.tif\" \"c:\\_script.txt\" \"c:\\test.jpg\" "

as You see I got double backshlashes and single backslashes on a places
where they shouldn't be.
Any suggestions .... I'm really stuck .... again!

See http://www.pobox.com/~skeet/csharp/strings.html#debugger
 
Back
Top