Powershell 检查进程是否为插件

Powershell 检查进程是否为插件,powershell,Powershell,我想通过Powershell检查名为“jp2launcher”的进程是否是插件。我有以下命令用于命令行: wmic process where (name="jp2launcher.exe") get CommandLine 此命令的结果是: "C:\Program Files (x86)\Java\jre1.8.0_31\bin\jp2launcher.exe" -secure -plugin ... 因此,如果存在-plugin,则流程就是一个插件。有没有办法只选择作为插件的进程?有没有

我想通过Powershell检查名为“jp2launcher”的进程是否是插件。我有以下命令用于命令行:

wmic process where (name="jp2launcher.exe") get CommandLine
此命令的结果是:

"C:\Program Files (x86)\Java\jre1.8.0_31\bin\jp2launcher.exe" -secure -plugin ...
因此,如果存在
-plugin
,则流程就是一个插件。有没有办法只选择作为插件的进程?

有没有办法只选择作为插件的进程

这将查询WMI中命令行与字符串“-plugin”(并仅选择字段名称和命令行)匹配的进程:

获取WmiObject Win32|u进程|其中命令行-匹配“-plugin”|选择名称,命令行


现在如何仅选择名为“jp2launcher”的进程,以及如何将其进程ID保存到变量中


获取WmiObject Win32|u进程| Where CommandLine-match“-plugin”| Where Name-match“jp2launcher”|选择Name,CommandLine

现在如何仅选择名为“jp2launcher”的进程,以及如何将其进程ID保存到变量中?根据您的请求添加了另一个示例。我以为你想要名称和命令行匹配。也许我误解了你的问题,但你不能过滤命令吗?获取WmiObject Win32|进程|其中{$\.CommandLine-ne$null-和$\.CommandLine.Contains(“-plugin”)}选择CommandLine这对我来说很好,但是我必须在哪里设置对名称“jp2launcher”的选择?