process argument with spaces
hi i need to have argument that contain spaces.
in this case /SASE Lab Tools
is the subject. Under normal command line:
sslist -R -H -h sinsscm01.ds.net "/SASE Lab Tools"
how do i make that happen? Here is my code:
static void Main(string[] args)
{
开发者_StackOverflow中文版 System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "sslist.exe";
p.StartInfo.Arguments = "-R -H -h sinsscm01.ds.net /SASE Lab Tools";
}
p.StartInfo.Arguments = "-R -H -h sinsscm01.ds.net \"/SASE Lab Tools\"";
Also escape sequence list may be interesting for you - http://blogs.msdn.com/b/csharpfaq/archive/2004/03/12/88415.aspx
p.StartInfo.Arguments = @"-R -H -h sinsscm01.ds.net ""/SASE Lab Tools""";
This syntax will prevent other problems from occurring (e.g. with escapes of things like C:\my\path\to\afile.txt
etc)
精彩评论