Windows – How to kill a specific java process by application name

command lineprocesstask-managerwindows

Usual taskkill /im "java.exe" will kill all java processes in the list. I however, want to kill a specific one. The problem is to identify the right process as there are multiple java.exe processes that run simultaneously and not related to each other.

Is there any way to kill a process by application name rather than by process name? I have the application name showing in the Applications tab in Task Manager and manually I can right click on that application and choose "Go To Process". It will highlight the relevant java process. Is there anyway to do it from command line?

Best Answer

Using taskkill, you can kill a process based on window title using a filter.

taskkill /F /FI "WindowTitle eq Spotify" /T
  • /F - force task kill
  • /T - Kill child process
  • /FI - Filter the tasks

If the window title has quotes in it, you can escape the nested quotes with a backslash (\).

You can use tasklist in a similar manner to search for a task based on its window title.

tasklist /V /FI "WindowTitle eq Spotify"

You can use the * as a wildcard to match a pattern

tasklist /V /FI "WindowTitle eq S*"