很简单的功能,就是遍历所有进程,然后杀掉你你不需要的进程。 1.命名空间 using System.Diagnostics; 2.遍历所有进程 void GetAllProcessName() { listbox.Items.Clear(); allProcess = Process.GetProcesses(); foreach (Process p in allProcess) { tmpName = p.ProcessName; listbox.Items.Add(tmpName); } listbox.SelectedIndex = -1; } 3.杀掉你不需要的进程 void KillProcess(string processname) { Process[] thisProcess = Process.GetProcessesByName(processName); if (thisProcess.Length > 0) { for (int i = 0; i < thisProcess.Length; i++) { try { thisProcess[i].Kill(); //结束进程 } catch (Exception ex) { MessageBox.Show("结束进程失败!" + ex.Message); return; } } } }