"som...">

Quotation mark in line

I have a string with a variable, for example.

string path = @"C:\one\filename.exe" + arguments arguments: "-s -c -d > "somedirectory\some file.txt"" 

I have a problem with redirect output to "somedirectory\some file" If I put "\"" or char.ToString('"') , it is always interpreted as \" ... not one "

How do I put this character in arguments?

+4
source share
3 answers

You need to use \" .

The debugger shows it as \" , since it shows valid string literals.
However, the actual value in the string is " . (This can be seen in the text renderer)

In the verbatim literal ( @"..." ), use "" instead.

+17
source
 var arguments = @"-s -c -d > ""somedirectory\some file.txt"""; 

or

 var arguments = "-s -c -d > \"somedirectory\\some file.txt\""; 
+5
source
 string args = @"-s -c -d > ""somedirectory\some file.txt""" 

try it.

for more information http://msdn.microsoft.com/en-us/library/aa691090%28v=vs.71%29.aspx

0
source

All Articles