c#启动exe文件
最常见的ProcessStartInfo启动
ProcessStartInfo info = new ProcessStartInfo(); info.FileName = @"路径\exe的文件名"; info.Arguments = ""; info.WindowStyle = ProcessWindowStyle.Minimized; Process pro = Process.Start(info); pro.WaitForExit();
结束启动的exe的进程
Process[] allProgresse = System.Diagnostics.Process.GetProcessesByName("exe的进程名"); foreach (Process closeProgress in allProgresse) { if (closeProgress.ProcessName.Equals("exe的进程名")) { closeProgress.Kill(); closeProgress.WaitForExit(); break; } }
欢迎讨论,相互学习。
cdtxw@foxmail.com