打开和关闭指定程序

打开调用

//方法1
this.process1.StartInfo.FileName="Notepad.exe";
this.process1.Start();

//方法2
System.Diagnostics.Process.Start("Notepad.exe");

关闭

Process[] myProcesses;
myProcesses = Process.GetProcessesByName("Notepad");
foreach (Process instance in myProcesses)
{
    instance.WaitForExit(3000);
    instance.CloseMainWindow();
}
Contributors: FHL