← Back to Tiny Hacks

Find and Kill processes

Frequently I have to deal with misbehaving apps, background processes. I usually try to find and kill the processes via the terminal.

tasklist | findstr -i "processname"
taskkill /f /im process.exe

To save me some typing I've created a couple of bat files (that are saved to a directory in the path).

f.bat

tasklist | findstr -i %1

Usage

f firefox

Outputs something like

firefox.exe 15772 RDP-Tcp#29 2 435,316 K
firefox.exe 11728 RDP-Tcp#29 2 86,984 K
firefox.exe 19388 RDP-Tcp#29 2 16,200 K
firefox.exe 6772 RDP-Tcp#29 2 39,512 K
firefox.exe 14568 RDP-Tcp#29 2 434,832 K
firefox.exe 18076 RDP-Tcp#29 2 194,324 K
firefox.exe 15068 RDP-Tcp#29 2 33,568 K
firefox.exe 10292 RDP-Tcp#29 2 33,656 K
firefox.exe 12188 RDP-Tcp#29 2 33,408 K

k.bat

taskkill /f /im %1

Usage:

k firefox

Outputs something like

SUCCESS: The process "firefox.exe" with PID 7036 has been terminated.
SUCCESS: The process "firefox.exe" with PID 8064 has been terminated.
SUCCESS: The process "firefox.exe" with PID 13556 has been terminated.
SUCCESS: The process "firefox.exe" with PID 12252 has been terminated.
SUCCESS: The process "firefox.exe" with PID 6464 has been terminated.
SUCCESS: The process "firefox.exe" with PID 14232 has been terminated.
SUCCESS: The process "firefox.exe" with PID 7476 has been terminated.
SUCCESS: The process "firefox.exe" with PID 14800 has been terminated.