How to close a running port windows 10

How to close a running port windows 10

In Windows 10, you can close a running port using the Command Prompt or PowerShell.


  1. Press Win + X on your keyboard and select "Command Prompt (Admin)" or "Windows PowerShell (Admin)" from the menu. This will open the Command Prompt or PowerShell with administrator privileges.
  2. In the Command Prompt or PowerShell window, type the following command to view a list of all active connections and their corresponding port numbers:

netstat -ano | findstr :<Port_Number>        

  1. Replace <Port_Number> with the actual port number you want to close.
  2. Make a note of the "PID" (Process Identifier) associated with the port you want to close.
  3. Next, type the following command to terminate the process using the PID:

taskkill /F /PID <PID>        

  1. Replace <PID> with the actual Process ID you obtained in step 3.

Arthur Duarte

Full-stack Developer | PostgreSQL, React, Node

1mo

I've been having problems with open ports since I moved from VS Code to Cursor. Not sure why, but it seems like Cursor doesn't close ports automatically when you close a project. Your guide is the first one that shows up when I google "close port on Windows" (and I've googled that a lot in the past few months) so I'm here to say thanks for writing it :)

Like
Reply

To view or add a comment, sign in

More articles by Nadimul Haque

  • Difference Between Lazy and Eager Loading

    When working with Laravel, one of the most important skills you can develop is mastering how and when to load related…

    1 Comment

Insights from the community

Others also viewed

Explore topics