C#结束Explorer进程
2021-04-13 14:26
标签:except start style lin line cep .exe task length C#结束Explorer进程 标签:except start style lin line cep .exe task length 原文地址:https://www.cnblogs.com/enych/p/8979038.html private void Form1_Load(object sender, EventArgs e)
{
Process[] processes = Process.GetProcesses();//获取所有进程信息
for (int i = 0; i )
{
if (processes[i].ProcessName.ToLower() == "explorer")
{
try
{
processes[i].Kill(); //停止进程 explorer会自动重启
return;
}
catch (Exception)
{
Console.WriteLine("进程访问失败!");
}
}
}
}
private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("taskkill.exe", " /f /im explorer.exe"); //控制台执行结束进程
}
下一篇:C#遍历对象的方法