通过 ParentProcessID 杀死进程 [英] Kill process by ParentProcessID
本文介绍了通过 ParentProcessID 杀死进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过 ParentProcessID 杀死正在运行的进程.我想像你在命令行中那样做:
I want to kill a running process by its ParentProcessID. I want to do it like you can do it in the commandline:
wmic process where parentprocessid= 3008 terminate
但现在问题是,在 PowerShell 中,我将 ParentProcessID 作为这样的变量:
But now the thing is, in PowerShell I've the ParentProcessID as a variable like this:
$p = 3008
现在我想通过变量 $p
终止进程,但这不起作用:
And now I would like to kill the process by the varibale $p
but this doesn't work:
wmic process where parentprocessid= $p terminate
如果我将 ParentProcessID 存储在变量中,我如何通过其 ParentProcessID 终止进程?
How can I kill a process by its ParentProcessID, if I have the ParentProcessID stored in a variable?
推荐答案
我找到了解决方案,就是去掉="和变量名之间的空格.
I found the solution, it was just to remove the space between the "=" and the variable name.
wmic process where parentprocessid=$p terminate
这篇关于通过 ParentProcessID 杀死进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文