private void Form1_Load(object sender, EventArgs e)
{
Process[] processes = Process.GetProcesses();//获取所有进程信息
for (int i = 0; i < processes.Length; 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"); //控制台执行结束进程
}