[英]How to find the PID of a running command in cmd/powershell over SSH?
Something similar to echo $$;类似于 echo $$; 的东西python my_script.py > out.log
python my_script.py > out.log
Expected output:预期 output:
using cmd_command or powershell command使用 cmd_command 或 powershell 命令
If you are running PowerShell, the PID variable is available.如果您正在运行 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
See the other members available using:查看其他可用的成员:
Get-CimInstance -Class CIM_Process | Where-Object { $_.ProcessId -eq $PID } | Format-List -Property * -Force
or或者
Get-CimInstance -Class CIM_Process | Get-Member
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.