/// <summary>
/// 找到并关闭指定进程
/// 例如:"PPAP","knbcenter","PPSKernel","WordBook","BFAssistantSvc"
/// </summary>
/// <param name="argProcessNames">进程名称</param>
static void KillProcess(List<string> argProcessNames)
{ List<string> processNames = new List<string>();
foreach (string item in argProcessNames)
{ if (!processNames.Contains(item.ToUpper()))
processNames.Add(item.ToUpper());
}
Process[] a = Process.GetProcesses();
for (int i = 0; i < a.Count(); i++)
{ Process p = a[i];
string str = p.ProcessName;
Console.WriteLine(str);
if (processNames.Contains(str.ToUpper()))
{ a[i].Kill();
Console.WriteLine("关闭进程" + str); }
}
Console.ReadKey();
}