private void KillProcess(string processName)
{
//獲得進程對象,以用來操作
System.Diagnostics.Process myproc = new System.Diagnostics.Process();
//得到所有打開的進程
try
{
//獲得需要殺死的進程名
foreach (System.Diagnostics.Process thisproc in System.Diagnostics.Process.GetProcessesByName(processName))
{
//立即殺死進程 www.2cto.com
thisproc.Kill();
}
}
catch (Exception Exc)
{
throw new Exception("", Exc);
}
}
摘自 朱金拖的專欄