maya16
maya16

Reputation: 633

How to kill a java application by it's process id from windows cmd?

when i run the command: taskkill /f /pid 16140

I get this : ERROR: The process "16140" not found.

Upvotes: 1

Views: 11140

Answers (3)

Mithun Sasidharan
Mithun Sasidharan

Reputation: 20920

You can kill a process by the process ID (PID) or by image name (EXE filename).

Open up an Administrative level Command Prompt and run tasklist to see all of the running processes:

C:\>tasklist

 Image Name                     PID Session Name        Mem Usage
 ========================= ======== ================ ============
 firefox.exe                  26356 Console             139,352 K
 regedit.exe                  24244 Console               9,768 K
 cmd.exe                      18664 Console               2,380 K
 conhost.exe                   2528 Console               7,852 K
 notepad.exe                  17364 Console               7,892 K
 notepad.exe                  24696 Console              22,028 K
 notepad.exe                  25304 Console               5,852 K
 explorer.exe                  2864 Console              72,232 K

In the example above you can see the image name and the PID for each process. If you want to kill the firefox process run:

C:\>Taskkill /IM firefox.exe /F

or

C:\>Taskkill /PID 26356 /F

The /f flag is kills the process forcefully. Failure to use the /F flag will result in nothing happening in some cases. One example is whenever I want to kill the explorer.exe process I have to use the /F flag or else the process just does not terminate.

Upvotes: 2

SANTOSHKUMAR SINGH
SANTOSHKUMAR SINGH

Reputation: 476

taskkill /im myprocess.exe /f

The "/f" is for "force". If you know the PID, then you can specify that, as in:

taskkill /pid 1234 /f

Lots of other options are possible, just type taskkill /? for all of them. The "/t" option kills a process and any child processes; that may be useful to you

Upvotes: 1

Dave Pateral
Dave Pateral

Reputation: 1475

Right click on Name column in Task Manager, check PID to show PID of processes, then execute taskkill /pid {PID}.
Note that some processes cannot be terminated by taskkill, for example Task Manager.

enter image description here

Upvotes: 2

Related Questions