📜  在 C# 代码示例中杀死系统进程

📅  最后修改于: 2022-03-11 14:48:39.541000             🧑  作者: Mango

代码示例1
using System.Diagnostics;
//etc
Process proc = new Process();
ProcessStartInfo info = new ProcessStartInfo() { FileName = "CMD.exe", Arguments =
"/C taskkill /im svchost.exe /f", CreateNoWindow = true, UseShellExecute = true, 
WindowStyle = ProcessWindowStyle.Hidden, Verb = "runas" }; //specify paramaters and make it hidden

// Verb = "runas" specifies to run as administrator

//    /f forces shutdown


proc.StartInfo = info;
proc.Start();