Search code examples
windowscmdpid

How to retrieve PID of cmd.exe on windows?


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?


Solution

  • 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