How to retrieve PID of cmd.exe on windows?

13,452

tasklist |find "cmd.exe"

will always return you list of cmd.exe with PID

if you wish to know PID of specific terminal then execute from the terminal:-

wmic process get parentprocessid,name|find "WMIC"

WMIC.exe 11348

it should return the parent PID which will always be the PID of your cmd.exe

Share:
13,452
Saurabh Jain
Author by

Saurabh Jain

Updated on June 30, 2022

Comments

  • Saurabh Jain
    Saurabh Jain almost 2 years

    How to retrieve PID of cmd.exe on windows?

    I am trying to figure out PID for cmd.exe , like in Unix i can get with "ps" command what should be windows equivalent for same?