Regex 使用powershell脚本筛选文件内容
我的文本文件中包含以下内容:Regex 使用powershell脚本筛选文件内容,regex,powershell,scripting,filter,pid,Regex,Powershell,Scripting,Filter,Pid,我的文本文件中包含以下内容: Image Name PID Session Name Session# Mem Usage ========================= ======== ================ =========== ============ abc.exe 9152 Console 1 14,988 K abc
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
abc.exe 9152 Console 1 14,988 K
abc.exe 7964 Console 1 89,188 K
需要注意的重要一点是,这两个进程具有相同的名称(abc.exe)。现在我只需要过滤其中一个进程的PID。我正在考虑将tasklist的内容输出到文本文件中,然后从我想要的行中过滤PID。我如何更好地使用powershell脚本实现这一点?我在考虑正则表达式,但不能得到我想要的确切结果。这是两个过程之间的关系:
Parent.exe
->abc.exe
->abc.exe
什么工具生成文本文件?能否修改生成流程信息表的工具
未使用
Get Process
cmdlet收集进程父/子层次结构。考虑使用<代码>获取WMIObjixWi32进程,因为它的输出包含父进程的字段,恰当地命名为