我正在尝试从一段代码中启动一个进程,但我希望该代码在进程完成并退出之前暂停执行。目前,我正在使用System.Diagnostics.Process.Start()类来启动(具体地说)卸载程序,并且在之后执行的代码依赖于安装程序卸载程序在恢复执行之前完成。
以下是代码:
using System.Diagnostics;
var procStIfo = new ProcessStartInfo("cmd", "/c " + variableContainingUninstallerPath);
procStIfo.RedirectStandardOutput = true;
procStIfo.UseShellExecute = false;
procStIfo.CreateNoWindow = true;
var proc = new Process();
proc.StartInfo = procStIfo;
proc.Start();