kill an application that is running on a specific port.[Windows]

In this post, we will discuss how to kill an application that is running on a specific port number using the command prompt. This is a useful technique to know if you are trying to free up a port that is already in use, or if you want to stop an application that is causing problems on your system.

Step 1: Find the PID (process ID) of the application:

In order to kill an application by its port number, we first need to find the PID (process ID) of the application. To do this, we can use the “netstat” command, which displays active connections and port information for your system. Type the following command into the command prompt:

netstat -aon | find ":port_number"

Replace “port_number” with the actual port number that you want to find the PID for. For example, if you want to find the PID for an application running on port 80, you would type:

netstat -aon | find ":80"

This command will return a list of active connections and port information, including the PID of the application running on the specified port.

Step 2: Kill the application

Once you have the PID of the application, you can use the “taskkill” command to kill the application.Type the following command into the command prompt:

taskkill /PID pid_number /F

Replace “pid_number” with the actual PID of the application that you want to kill. For example, if the PID of the application you want to kill is 3685, you would type:

taskkill /PID 3685 /F

The “/F” flag at the end of the command tells the taskkill command to force the application to close, even if it is not responding.

Conclusion:

  • In this post, we learned how to kill an application by its port number using the command prompt.
  • By using netstat and taskkill commands, we were able to find the PID of the application and then kill it, freeing up the port and stopping the application.
  • This is a useful technique to know if you need to troubleshoot problems with applications on your system.