bat wmic python 获取进程的所在路径
wmic process where name="process-name" get executablepath
wmic process where "name like '%chrome%'" get processid,commandline /format:list
python:
import subprocesscmd = 'wmic process where "name=\'notepad.exe\'" get ExecutablePath'proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)print proc.stdout.read()
参考链接:
获取其它属性:
- Caption
- CommandLine
- CreationClassName
- CreationDate
- CSCreationClassName
- CSName
- Description
- ExecutablePath
- ExecutionState
- Handle
- HandleCount
- InstallDate
- KernelModeTime
- MaximumWorkingSetSize
- MinimumWorkingSetSize
- Name
- OSCreationClassName
- OSName
- OtherOperationCount
- OtherTransferCount
- PageFaults
- PageFileUsage
- ParentProcessId
- PeakPageFileUsage
- PeakVirtualSize
- PeakWorkingSetSize
- Priority
- PrivatePageCount
- ProcessId
- QuotaNonPagedPoolUsage
- QuotaPagedPoolUsage
- QuotaPeakNonPagedPoolUsage
- QuotaPeakPagedPoolUsage
- ReadOperationCount
- ReadTransferCount
- SessionId
- Status
- TerminationDate
- ThreadCount
- UserModeTime
- VirtualSize
- WindowsVersion
- WorkingSetSize
- WriteOperationCount
- WriteTransferCount