-2

I´d want to know how to get a PID of a process with a single command in command prompt.
I tried it with findstr, but I´m (apparently) not so smart to figure it out. You cannot use tasklist, because you ´ill need to find PID of cmd.exe your self. So, what´s the command to do
this searching automatic?

Command Bomb
  • 9
  • 1
  • 2

1 Answers1

2

You don't tell us about your OS, but i can see 2 ways for this :

E.g : to find PID for process cmd.exe :

tasklist /FI "IMAGENAME eq cmd.exe" /FO LIST | findstr "PID:"

PID:                 8748

Powershell :

Get-Process cmd | select-object id

   Id
   --
 8748
krisFR
  • 13,280
  • 4
  • 36
  • 42