如何从Winform应用程序执行cmd命令并关闭应用程序?

时间:2019-04-11 09:25:57

标签: c# cmd uninstall

有没有办法从Winform C#应用程序解析cmd命令并在该命令执行时关闭应用程序? (我想解析2个命令:第一个是卸载当前应用程序,第二个是安装msi文件)

我尝试使用Process.Start执行unistall命令,但对我而言不起作用。

string unistall = "/x [ProductCode] /quiet";            
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
startInfo.FileName = "msiexec.exe";
startInfo.Arguments = unistall;

process.StartInfo = startInfo;
process.Start();

我希望该应用将向命令行发送两个命令并关闭自身,而无需等待命令完成。

0 个答案:

没有答案
相关问题