Skip to content

sv26000/windows-port-killer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Windows Port Killer πŸ”§

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.

Why This Tool?

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!

Features

  • βœ… 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

Usage

  1. Download the kill-port.bat file
  2. Run it by double-clicking or from command prompt
  3. Enter the port number when prompted
  4. 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

Installation

Option 1: Download and Run

  1. Download kill-port.bat
  2. Save it anywhere on your system
  3. Double-click to run

Option 2: Add to PATH (Recommended)

  1. Download kill-port.bat
  2. Move it to a folder in your PATH (e.g., C:\Windows\System32 or create a C:\tools folder and add it to PATH)
  3. Now you can run kill-port from anywhere in Command Prompt

Option 3: Clone Repository

git clone https://github.com/yourusername/windows-port-killer.git
cd windows-port-killer

Common Use Cases

  • 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

How It Works

The script uses Windows built-in commands:

  1. netstat -ano - Lists all active connections with process IDs
  2. findstr - Filters for your specific port
  3. taskkill /F /PID - Force kills the process

Requirements

  • Windows 7 or later
  • No additional software required
  • Works in corporate environments where PowerShell might be restricted

Safety Note

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.

Windows SmartScreen Warning

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:

  1. Click "More info" on the warning dialog
  2. Click "Run anyway"
  3. 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.

Contributing

Found a bug or have a suggestion? Feel free to:

  • Open an issue
  • Submit a pull request
  • Share your feedback

License

MIT License - Feel free to use, modify, and distribute!

Support

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!

About

πŸ”§ Simple Windows batch script to quickly kill processes running on specific ports. Perfect for developers dealing with occupied development ports.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors