日期:2014-05-18 浏览次数:20861 次
foreach (System.Diagnostics.Process thisproc in System.Diagnostics.Process.GetProcesses()) { if(thisproc.ProcessName.Equals("explorer")) { thisproc.Kill(); } }
------解决方案--------------------
Process[] ps = Process.GetProcesses();
for (int i = 0; i < ps.Length; i++)
{
if (ps[i].ProcessName == "进程的名字")
{
try
{
ps[i].Kill();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}