Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quotation mark in string

I have some string with variable, e.g.

string path = @"C:\one\filename.exe" + arguments

arguments: "-s -c -d > "somedirectory\some file.txt""

I've problem with redirection output to "somedirectory\some file" If I put "\"" or char.ToString('"') it always interprets as \"...not alone "

How should I put this " character into arguments?

like image 234
Saint Avatar asked Nov 29 '22 18:11

Saint


1 Answers

You need to use \".

The debugger shows it as \", since it shows valid string literals.
However, the actual value in the string is ". (You can see this in the Text Visualizer)

In a verbatim string literal (@"..."), you need to use "" instead.

like image 193
SLaks Avatar answered Dec 01 '22 07:12

SLaks