有没有一个命令行工具来显示WS专用字节?

在Process Explorer中,它是WS Private Bytes ,而在Task Manager中则是Private Working Set

我想要一个命令行实用程序来显示给定进程名称的信息。

编辑

一个PowerShell脚本也可以做。

Solutions Collecting From Web of "有没有一个命令行工具来显示WS专用字节?"

PowerShell您可以使用:

[编辑]

 function ProcessInfo { param ([String]$processName) $workingSet = get-counter -counter "\Process($processName)\Working Set - Private" | select -expandproperty countersamples | select cookedvalue $privateBytes = get-counter -counter "\Process($processName)\Private Bytes" | select -expandproperty countersamples | select cookedvalue get-process $processName | select ` name, ` @{Name="Private Working Set"; Expression = {$workingSet.CookedValue}},` @{Name="WS Private Bytes"; Expression = {$privateBytes.CookedValue}} } ProcessInfo("winrar") 

[EDIT2]

这是一个改进的版本,它将进程ID作为参数。

 function GetProcessInfoById { param ([int]$processId) Get-WmiObject -class Win32_PerfFormattedData_PerfProc_Process | where{$_.idprocess -eq $processId} | select ` @{Name="Process Id"; Expression = {$_.idprocess}},` @{Name="Counter Name"; Expression = {$_.name}},` @{Name="Private Working Set"; Expression = {$_.workingSetPrivate / 1kb}} } GetProcessInfoById 380 

这里是一个将进程名称作为参数的版本。 这可能会返回多个值(每个进程的实例一个值),您可以通过Process Id的值来识别进程。

 function GetProcessInfoByName { param ([string]$processName) Get-WmiObject -class Win32_PerfFormattedData_PerfProc_Process | where{$_.name -like $processName+"*"} | select ` @{Name="Process Id"; Expression = {$_.idprocess}},` @{Name="Counter Name"; Expression = {$_.name}},` @{Name="Private Working Set"; Expression = {$_.workingSetPrivate / 1kb}} } GetProcessInfoByName svchost