开发者

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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜