A simple and efficient Windows batch script to quickly kill processes running on specific ports. Perfect for developers who frequently need to free up ports during development.
As developers, we've all been there - you need to restart your development server, but the port is still occupied. Instead of opening Task Manager, finding the process, and killing it manually (or remembering complex command combinations), just run this script!
- β Simple & Fast: Just enter the port number and it's done
- β Safe: Shows you which process it found before killing
- β No Admin Rights: Works without elevated permissions in most cases
- β Corporate Friendly: Pure batch file - no PowerShell restrictions
- β Informative: Clear feedback on what's happening
- Download the
kill-port.batfile - Run it by double-clicking or from command prompt
- Enter the port number when prompted
- Done! The process will be terminated
Enter port number to kill: 3000
Finding process on port 3000...
Found process with PID 12345 using port 3000
Killing process...
Process killed successfully
- Download
kill-port.bat - Save it anywhere on your system
- Double-click to run
- Download
kill-port.bat - Move it to a folder in your PATH (e.g.,
C:\Windows\System32or create aC:\toolsfolder and add it to PATH) - Now you can run
kill-portfrom anywhere in Command Prompt
git clone https://github.com/yourusername/windows-port-killer.git
cd windows-port-killer- React Development: Kill port 3000 when Create React App won't restart
- Node.js: Free up Express server ports
- Python Flask/Django: Clear occupied development ports
- Any Local Server: Works with any application using TCP ports
The script uses Windows built-in commands:
netstat -ano- Lists all active connections with process IDsfindstr- Filters for your specific porttaskkill /F /PID- Force kills the process
- Windows 7 or later
- No additional software required
- Works in corporate environments where PowerShell might be restricted
This script uses taskkill /F (force kill) which immediately terminates the process. Make sure you've saved any important work in applications that might be using the port.
When you first run the script, Windows Defender SmartScreen might show a warning because the file isn't digitally signed. This is normal and safe. To run the script:
- Click "More info" on the warning dialog
- Click "Run anyway"
- Or right-click the file β Properties β check "Unblock" if available
This is a security feature that appears for any unsigned executable files, including batch scripts.
Found a bug or have a suggestion? Feel free to:
- Open an issue
- Submit a pull request
- Share your feedback
MIT License - Feel free to use, modify, and distribute!
If you find this tool helpful, consider:
- β Starring this repository
- π΄ Forking it for your own modifications
- π’ Sharing it with fellow developers
Made with β€οΈ for developers who are tired of the 2-step port killing process!