Use Process.Start with parameters AND spaces in path

后端 未结 4 1714
伪装坚强ぢ
伪装坚强ぢ 2020-12-01 13:33

I\'ve seen similar examples, but can\'t find something exactly like my problem.

I need to run a command like this from C#:

C:\\FOLDER\\folder with sp         


        
4条回答
  •  情书的邮戳
    2020-12-01 14:38

    Try this

    ProcessStartInfo startInfo = new ProcessStartInfo();
    startInfo.CreateNoWindow = false;
    startInfo.UseShellExecute = false;
    startInfo.FileName =  "\"C:\\FOLDER\\folder with   spaces\\OTHER_FOLDER\\executable.exe\"";
    startInfo.Arguments = "p1=hardCodedv1 p2=v2";
    Process.Start(startInfo);
    

提交回复
热议问题