如何区分用户启动的进程和系统启动的进程?
我的代码片段是这样的:-
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();
}
实际上我想停止所有用户启动的进程,但不是系统启动的进程。
My code snippet is like this:-
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();
}
actually i want to stop all user-initiated processes but not system-initiated processes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要终止大多数用户启动的进程:
To kill most user initiated processes:
在 Bytes.com 上找到:获取进程帐户名称。
您可以使用 System.Management 和 Win32_Process 类。
Found here on Bytes.com : Get Process Account Name.
You can use System.Management and the Win32_Process class.