如何在C#代码中调用exe执行文件

2025-02-02 23:09:21
推荐回答(3个)
回答1:

using System.Diagnostics;
Process.Start("nodepad.exe");  // 把nodepad.exe换成要调用的exe执行文件完成路径

回答2:


System.Diagnostics.Process.Start("文件名");
//如打开计算器System.Diagnostics.Process.Start("calc");

回答3:

public static void StartProcessNoWait(string exe)
{
try
{
System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(exe);
info.UseShellExecute = false;
info.WorkingDirectory = System.IO.Path.GetDirectoryName(exe);
System.Diagnostics.Process pro = System.Diagnostics.Process.Start(info);
pro.Close();
pro = null;
}
catch (Exception ex)
{
throw ex;
}
}