Windows wmic路径win32_进程get中的多个参数

Windows wmic路径win32_进程get中的多个参数,windows,powershell,wmic,wmi,cim,Windows,Powershell,Wmic,Wmi,Cim,我想用几个参数运行这个命令wmic path Win32\u Process get ParentProcessId、commandLine、creationdate、executablepath、name、processId,但是如果我试图用逗号分隔的方式编写,powershell会对语法发誓。需要修复什么?默认情况下,/cmdlet为您提供所接收对象上类的所有属性,因此您无需指定每个属性: $wmi = Get-WmiObject -Class Win32_Process $wmi | Ge

我想用几个参数运行这个命令
wmic path Win32\u Process get ParentProcessId、commandLine、creationdate、executablepath、name、processId
,但是如果我试图用逗号分隔的方式编写,powershell会对语法发誓。需要修复什么?

默认情况下,/cmdlet为您提供所接收对象上类的所有属性,因此您无需指定每个属性:

$wmi = Get-WmiObject -Class Win32_Process
$wmi | Get-Member -MemberType Property

$props = 'ParentProcessId', 'CommandLine', 'CreationDate', 'ExecutablePath', 'Name', 'ProcessId'
$wmi | Select-Object -Property $props
作为最佳实践:如果给您一个本机抽象(在本例中为
getwmiobject
getcimpinstance
),您应该使用它

默认情况下,/cmdlet为您提供所接收对象上类的所有属性,因此您无需指定每个属性:

$wmi = Get-WmiObject -Class Win32_Process
$wmi | Get-Member -MemberType Property

$props = 'ParentProcessId', 'CommandLine', 'CreationDate', 'ExecutablePath', 'Name', 'ProcessId'
$wmi | Select-Object -Property $props

作为最佳实践:如果给您一个本机抽象(在本例中为
getwmiobject
getcimpinstance
),您应该使用它

逗号表示数组。如果您真的想使用wmic,可以使用神奇的“停止解析”操作符:

wmic --% path Win32_Process get ParentProcessId, commandLine, creationdate, executablepath, name, processId
Get-WMIOObject或Get-ciminstance将输出更易于操作的对象。Get-ciminstance甚至在类名上有制表符完成,通过管道选择对象或在何处对象,您可以在属性上获得制表符完成

get-ciminstance win32_process | select parentprocessId, commandLine, creationdate, executablepath, name, processId
get-ciminstance win32_process | where commandline -match chrome

逗号表示数组。如果您真的想使用wmic,可以使用神奇的“停止解析”操作符:

wmic --% path Win32_Process get ParentProcessId, commandLine, creationdate, executablepath, name, processId
Get-WMIOObject或Get-ciminstance将输出更易于操作的对象。Get-ciminstance甚至在类名上有制表符完成,通过管道选择对象或在何处对象,您可以在属性上获得制表符完成

get-ciminstance win32_process | select parentprocessId, commandLine, creationdate, executablepath, name, processId
get-ciminstance win32_process | where commandline -match chrome

我使用ucmdb。我不得不用一些命令来验证。这个命令是用问题中包含的版本编写的。我使用ucmdb。我不得不用一些命令来验证。此命令是用问题中包含的版本编写的。