我想使用CMD运行VisualDisableOutOfProcBuild.exe安装程序,但CMD运行时不执行命令

问题描述 投票:0回答:1

我尝试以管理员身份运行我的软件并检查是否是权限问题,但无济于事。

string command = "cd \"C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\Common7\\IDE\\CommonExtensions\\Microsoft\\VSI\\DisableOutOfProcBuild\" && DisableOutOfProcBuild.exe";
 Process process1 = new Process();
 process1.StartInfo.FileName = "C:\\Windows\\System32\\cmd.exe";
 process1.StartInfo.Arguments = command;
      

 process1.StartInfo.UseShellExecute = false;
 process1.StartInfo.RedirectStandardOutput = true;
 process1.StartInfo.RedirectStandardError = true; // Activer la redirection de la sortie d'erreur
 process1.StartInfo.CreateNoWindow = false;
 process1.StartInfo.Verb = "runas";


  process1.Start();
 process1.BeginOutputReadLine();
 process1.BeginErrorReadLine();
 process1.WaitForExit();
c# cmd command-line accessibility admin
1个回答
0
投票

在命令字符串中先放 /C

/C cd \C:\Program Files\Microsoft Visual Studio�2\Professional\Common7\IDE\CommonExtensions\Microsoft\VSI\DisableOutOfProcBuild\ && DisableOutOfProcBuild.exe

© www.soinside.com 2019 - 2024. All rights reserved.