Double quotes...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

String s = @"c:\test.xml";

I want to use the above string in a batch file with enclosed quotes, like
""c:\test.xml""

How can i do that? It might be simple, but I can't figure out the syntax??
 
Gaurav said:
String s = @"c:\test.xml";

I want to use the above string in a batch file with enclosed quotes, like
""c:\test.xml""

How can i do that? It might be simple, but I can't figure out the syntax??

""c:\test.xml"" -> "\"c:\\test.xml\""

OR

""c:\test.xml"" -> @"""c:\test.xml"""

Alun Harford
 
""c:\test.xml"" -> "\"c:\\test.xml\""

OR

""c:\test.xml"" -> @"""c:\test.xml"""

Alun Harford

Simply escape the \ as well as the "

String s = "\"c:\\test.xml\"";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top