Process.Start filename using %temp%

后端 未结 5 1885
孤街浪徒
孤街浪徒 2021-01-20 04:48

For some odd reaseon this code fails:

p.StartInfo.FileName = @\"%temp%\\SSCERuntime_x86-ENU.msi\";

and this code succes:

p.         


        
5条回答
  •  孤街浪徒
    2021-01-20 05:35

    Try this:

    string tempPath = Environment.GetEnvironmentVariable("Temp");
    

    Then concat it in:

    p.StartInfo.FileName = Path.Combine(tempPath, "SSCERuntime_x86-ENU.msi"); 
    

    Casper beat me to the punch on the explaination, but the Process.Start method basically treats it literally instead of intrperting it as the shell would.

提交回复
热议问题