[英]How to find the PID of a running command in cmd/powershell over SSH?
類似於 echo $$; 的東西 python my_script.py > out.log
預期 output:
使用 cmd_command 或 powershell 命令
如果您正在運行 PowerShell,則 PID 變量可用。
PS C:\> $PID
8420
PS C:\> Get-CimInstance -Class CIM_Process | Where-Object { $_.ProcessId -eq $PID }
ProcessId Name HandleCount WorkingSetSize VirtualSize
--------- ---- ----------- -------------- -----------
8420 pwsh.exe 1004 119939072 2204255981568
查看其他可用的成員:
Get-CimInstance -Class CIM_Process | Where-Object { $_.ProcessId -eq $PID } | Format-List -Property * -Force
或者
Get-CimInstance -Class CIM_Process | Get-Member
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.