String manipulation

  • Thread starter Thread starter Lee
  • Start date Start date
L

Lee

Hi All,

I need to make a string look like this. I am calling a program and need to
send args to it.

"c:\program files\program dir\prog.exe" /B "c:\config files\file1.txt"

The quotes need to be passed exactly as they are in that string or it will
not work. I need the quotes or I end up getting things trucated.

Thanks

Lee
 
Try

@"""c:\program files\program dir\prog.exe"" /B ""c:\config
files\file1.txt"""
 
This is what I get that that:

"\"C:\\program files\\program dir\\prog.exe\" /B \"C:\\config
files\\files1.txt\""

That is right out of the watch window

Jared Parsons said:
Try

@"""c:\program files\program dir\prog.exe"" /B ""c:\config
files\file1.txt"""
--
Jared Parsons [MSFT]
(e-mail address removed)
http://blogs.msdn.com/jaredpar
"This posting is provided "AS IS" with no warranties, and confers no
rights"
Lee said:
Hi All,

I need to make a string look like this. I am calling a program and need
to send args to it.

"c:\program files\program dir\prog.exe" /B "c:\config files\file1.txt"

The quotes need to be passed exactly as they are in that string or it
will not work. I need the quotes or I end up getting things trucated.

Thanks

Lee
 
That's still the program representation. If you print that string out, say
to the console, it should be as you specified

--
Jared Parsons [MSFT]
(e-mail address removed)
http://blogs.msdn.com/jaredpar
"This posting is provided "AS IS" with no warranties, and confers no rights"
Lee said:
This is what I get that that:

"\"C:\\program files\\program dir\\prog.exe\" /B \"C:\\config
files\\files1.txt\""

That is right out of the watch window

Jared Parsons said:
Try

@"""c:\program files\program dir\prog.exe"" /B ""c:\config
files\file1.txt"""
--
Jared Parsons [MSFT]
(e-mail address removed)
http://blogs.msdn.com/jaredpar
"This posting is provided "AS IS" with no warranties, and confers no
rights"
Lee said:
Hi All,

I need to make a string look like this. I am calling a program and need
to send args to it.

"c:\program files\program dir\prog.exe" /B "c:\config files\file1.txt"

The quotes need to be passed exactly as they are in that string or it
will not work. I need the quotes or I end up getting things trucated.

Thanks

Lee
 
Back
Top