-->

如何让资源管理器中的进程ID从Powershell的推出(How to get the proces

2019-09-21 12:00发布

我从Powershell的开始“Explorer.exe的”,并希望得到的资源管理器窗口的进程ID,这样我就不会在其他资源管理器窗口错误操作。

代码:开始处理“Explorer.exe的” -PassThru结果:我可以看到进程ID,但它与UISpy或在任务管理器窗口的实际进程id不同。 似乎Explorer.exe的启动另一个进程(B)可以退出本身,最后我们看到的过程(B)。 而且我得到了这个过程是已退出进程。 问:我怎样才能得到真正的进程ID(B)?

Answer 1:

Explorer.exe的瞬间将开始一个全新的过程,但这个过程会很快死亡,移交其状态为现有的探险过程。 一般情况下,它不会持续,增加的过程中越来越多的收藏,因为所有的程序会。

看到这个动作:

"Old explorer.exe instances"
Get-Process explorer

Start-Process explorer.exe
sleep 1  # wait for this one to die

"New explorer.exe instances"
Get-Process explorer

你会看到它的同一套资源管理器的实例。 我认为这是关系到REG键HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced [SeparateProcess]



文章来源: How to get the process id of Explorer launched from Powershell