kill process windows cmd code example

Example 1: cmd kill process

## check and kill used "ports"
netstat -ano | findstr :8080
taskkill /PID <yourid> /F

Example 2: windows kill process

// Kill process by exe name
taskkill /IM "ProcessName.exe" /F

Example 3: script to kill a process in windows

taskkill /PID 1234

Example 4: kill process cmd

netstat -ano | findstr :3000
taskkill /PID "123" /F

Example 5: cmd kill pid

taskkill /F /PID pid_number

Example 6: cmd taskkill

@echo off

:: ganti browser.exe dengan nama target yang mau di kill
:: buka taskmanager pilih -> details -> kemudian ambil namanya
:: jika ingin multiple taskkill process tambahkan hal yang sama seperti fungsi sebelumnya dibawahnya

taskkill /FI "PID gt 1000" /FI "IMAGENAME eq browser.exe" /F /T
cls
taskkill /FI "PID gt 1000" /FI "IMAGENAME eq code.exe" /F /T
cls
taskkill /FI "PID gt 1000" /FI "IMAGENAME eq spotify.exe" /F /T
cls
taskkill /FI "PID gt 1000" /FI "IMAGENAME eq chrome.exe" /F /T
cls

exit

Tags:

Misc Example