使用Dos窗口获取Windows进程的优先级

使用Dos窗口获取Windows进程的优先级


写自动化测试时候,发现需要获取windows进程的优先级。以此来记录一下

下面为CMD命令

powershell -Command "&{Get-WmiObject Win32_process -filter 'name = \"procexp.exe\"'}"

命令执行结果如下
Priority : 8
优先级为Normal

__GENUS                    : 2
__CLASS                    : Win32_Process
__SUPERCLASS               : CIM_Process
__DYNASTY                  : CIM_ManagedSystemElement
__RELPATH                  : Win32_Process.Handle="2916"
__PROPERTY_COUNT           : 45
__DERIVATION               : {CIM_Process, CIM_LogicalElement, CIM_ManagedSystemElement}
__SERVER                   : WIN-CRJ1KRBS7HL
__NAMESPACE                : root\cimv2
__PATH                     : \\WIN-CRJ1KRBS7HL\root\cimv2:Win32_Process.Handle="2916"
Caption                    : procexp.exe
CommandLine                : "C:\Users\Administrator\Desktop\procexp.exe"
CreationClassName          : Win32_Process
CreationDate               : 20201211173351.450646+540
CSCreationClassName        : Win32_ComputerSystem
CSName                     : WIN-CRJ1KRBS7HL
Description                : procexp.exe
ExecutablePath             : C:\Users\Administrator\Desktop\procexp.exe
ExecutionState             :
Handle                     : 2916
HandleCount                : 211
InstallDate                :
KernelModeTime             : 5937500
MaximumWorkingSetSize      : 1380
MinimumWorkingSetSize      : 200
Name                       : procexp.exe
OSCreationClassName        : Win32_OperatingSystem
OSName                     : Microsoft Windows Server 2016 Datacenter|C:\Windows|\Device\Harddisk0\Partition4
OtherOperationCount        : 1977
OtherTransferCount         : 1414
PageFaults                 : 4849
PageFileUsage              : 2816
ParentProcessId            : 4404
PeakPageFileUsage          : 3132
PeakVirtualSize            : 115392512
PeakWorkingSetSize         : 10692
Priority                   : 8
PrivatePageCount           : 2883584
ProcessId                  : 2916
QuotaNonPagedPoolUsage     : 12
QuotaPagedPoolUsage        : 193
QuotaPeakNonPagedPoolUsage : 13
QuotaPeakPagedPoolUsage    : 213
ReadOperationCount         : 1
ReadTransferCount          : 174978
SessionId                  : 1
Status                     :
TerminationDate            :
ThreadCount                : 2
UserModeTime               : 1093750
VirtualSize                : 102998016
WindowsVersion             : 10.0.14393
WorkingSetSize             : 10752000
WriteOperationCount        : 2
WriteTransferCount         : 1487224
PSComputerName             : WIN-CRJ1KRBS7HL
ProcessName                : procexp.exe
Handles                    : 211
VM                         : 102998016
WS                         : 10752000
Path                       : C:\Users\Administrator\Desktop\procexp.exe

只获取优先级,可以添加过滤

powershell -Command "&{Get-WmiObject Win32_process -filter 'name = \"procexp.exe\"'}"|findstr Priority*

结果如下

Priority                   : 8
上一篇:如何快速判断一个文件是否为病毒


下一篇:Qt使用qwtplot3d绘制3D曲面