获得当前计算机系统内所有的已启动的进程:
System.Diagnostics.Process[] processOnComputer = System.Diagnostics.Process.GetProcesses();
foreach ( System.Diagnostics.Process p in processOnComputer )
{
System.Console.WriteLine(p.ToString());
}
Console.ReadLine();
获得当前计算机系统内某个进程并关闭:
System.Diagnostics.Process[] process = System.Diagnostics.Process.GetProcessesByName("进程名称");
foreach ( System.Diagnostics.Process p in process)
{
p.Kill();
}