当我开始新的chrome进程时,windows os正在为此创建一个新进程。我的问题是如何才能获得该流程的ID或任何阻止该流程的方法?
答案 0 :(得分:0)
您必须使用using System.Diagnostics;
命名空间,代码如下。
IEnumerable<int> pids = Process.GetProcessesByName("chrome").Select(p => p.Id);
// do some stuff with PID if you want to kill them, do the following
foreach (int pid in pids) {
Process.GetProcessById(pid).Kill();
}