0

How do I get the PID of an EXE file from Windows command line?

I want to query the PID from the command line, rather than manually search in Task Manager.

I've found something similar in nix

slightly_toasted
  • 804
  • 5
  • 14

2 Answers2

2

PowerShell Get-Process can return the PID of running processes.

❯ Get-Process explorer

 NPM(K)    PM(M)      WS(M)     CPU(s)      Id  SI ProcessName
 ------    -----      -----     ------      --  -- -----------
    135   218.04     218.04     140.12   34304   3 explorer

❯ (Get-Process explorer).Id
34304

Documentation

Josh Zhang
  • 159
  • 9
0

In unlikely event that you don't want PowerShell then there is also tasklist

NiKiZe
  • 1,246
  • 8
  • 20