c# 通过代码执行bat、exe等
public static void RunBat()
{
// 脚本或程序所在目录
string batPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase+"bat";
Console.WriteLine(batPath);
Process proc = new Process();
if (File.Exists(batPath+ "\\close.bat"))
{
proc.StartInfo.WorkingDirectory = batPath;
// 所执行的bat
proc.StartInfo.FileName = "close.bat";
proc.StartInfo.UseShellExecute = true;
proc.Start();
// 等待窗口关闭
proc.WaitForExit();
}
}