string PRocessName="explorer";//这里换成你需要删除的进程名称 Process[] MyProcess1=Process.
GetProcessesByName(ProcessName);Process MyProcess=new Process();//设定程序名 MyProcess.StartInfo.FileName="cmd.exe";//关闭Shell的使用 MyProcess.StartInfo.UseShellExecute=false;//重定向标准输入 MyProcess.StartInfo.RedirectStandardInput=true;//重定向标准输出 MyProcess.StartInfo.RedirectStandardOutput=true;//重定向错误输出 MyProcess.StartInfo.RedirectStandardError=true;//设置不显示窗口 MyProcess.StartInfo.CreateNoWindow=true;//执行强制结束命令 MyProcess.Start();MyProcess.StandardInput.WriteLine("ntsd -c q -p "
+(MyProcess1[0].Id).ToString());//直接结束进程ID MyProcess.StandardInput.WriteLine("Exit");第二种,通过强大的进程类进行标准关闭。string ProcessName="explorer";//换成想要结束的进程名字 Process[] MyProcess=Process.
GetProcessesByName(ProcessName);MyProcess[0].Kill();
新闻热点
疑难解答