我有一个NOTEPAD.EXE在我的会议开始:故障与WMI过滤
gwmi -Query "Select CommandLine from Win32_Process where CommandLine='C:\Windows\system32\notepad.exe'"
给
Get-WmiObject : Demande non valide
Au niveau de ligne : 1 Caractère : 5
+ gwmi <<<< -Query "Select CommandLine from Win32_Process where CommandLine='C:\Windows\system32\notepad.exe'"
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
我测试:
gwmi -Query "Select CommandLine from Win32_Process where CommandLine='C:\\Windows\\system32\\notepad.exe'"
它给什么
gwmi -Query "Select CommandLine from Win32_Process where CommandLine LIKE '%C:\\Windows\\system32\\notepad.exe%'"
完美的作品
__GENUS : 2
__CLASS : Win32_Process
__SUPERCLASS :
__DYNASTY :
__RELPATH :
__PROPERTY_COUNT : 1
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
CommandLine : "C:\Windows\system32\notepad.exe"
也许是使用PowerShell和WMI之间通配符caracters一个麻烦,但任何人都可以帮我做过滤CommandLine='C:\Windows\system32\notepad.exe'
工作
在找到的(找到的)'Win32_Process'实例上'CommandLine'的值是多少?例如。这里'CommandLine'的值包含双引号。 – Richard
我编辑问题以显示值如果属性,它的工作。 如果你看看WMBEMTEST.EXE'CommandLine'是'WIN32_Process'的一个属性。 – JPBlanc
问题是CommandLine被gwmi查询中的“。how escape”包围了吗? –