强制终结置顶进程。
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; namespace KillProcess { class Program { static void Main(string[] args) { Console.WriteLine("结束所有CMD.EXE程序"); Process[] ps = Process.GetProcesses(); foreach (Process p in ps) { if (p.ProcessName.Equals("cmd")) { p.Kill(); } } } } }