我有一個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」包圍了嗎? –