How to Manually Close a Port on Windows?

How to Manually Close a Port on Windows?

How to Manually Close a Port on Windows?

If you want to close a specific port (for example, 8081) on your computer, you can easily perform this operation by following the steps. In this guide, you will see step by step how to close a port using the netstat and taskkill commands.

Step 1: Find the Open Port

First, we need to find the program running on the specific open port. For this, we will use the netstat command. Run the following command in the command prompt (cmd):

netstat -ano | findstr :8081

This command lists the process and process ID (PID) running on port 8081.


Step 2: Terminate the Process

We will terminate the process using the PID (for example, 29232) we found. To do this, we will use the taskkill command. Enter the following command into the command prompt:

taskkill /pid 29232/F

This command forcefully terminates the process with the specified PID (using the /F parameter).

Result By following these steps, you can successfully manually close a specific port on the Windows operating system. That’s how simply and effectively the port closing process is completed.