我的代码段是这样的:

KillUserProcess()
{
  foreach (Process myProcess in Process.GetProcesses())
   {
      // here I need to know which is system process and which is user process:
       like --if(myProcess.type==user)
               myProcess.Kill();
}


实际上,我想停止所有用户启动的进程,而不是系统启动的进程。

最佳答案

要杀死大多数用户启动的进程:

 System.Diagnostics.Process.Start("shutdown -l");

09-07 08:02