I am using this command-
tasklist /FI "ImageName eq postgres.exe"
this is the output I am getting-
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
postgres.exe 2300 Services 0 19,752 K
postgres.exe 2932 Services 0 6,324 K
postgres.exe 2992 Services 0 8,660 K
postgres.exe 3000 Services 0 8,256 K
postgres.exe 3008 Services 0 11,128 K
postgres.exe 3016 Services 0 8,120 K
postgres.exe 3024 Services 0 7,756 K
postgres.exe 3032 Services 0 7,732 K
postgres.exe 1684 Services 0 20,732 K
To answer the comment and question.
(Get-Process postgres)[0].ID
Get-Process
get's all running processes with name postgres
[0]
grabs the first row
.ID
grabs the PID property
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.