Find which application occupies a certain port and force-kill the application

question

In Java development, we often encounter ports being occupied. At this time, we directly find out which application is occupying the port, and then kill it in the background process.

solve

In cmd, enter the command

Find which application is occupying a port

netstat -aon | findstr 端口号

Let’s take port 6200 as an example

netstat -ano | findstr 6200

Insert image description here
As you can see in the picture above, the last line is the pid: 15348

Kill app based on pid

Use the taskkill command to kill the process: taskkill /pid PID number

taskkill /pid 15348

However, some processes need to be forced to kill: taskkill /f /pid PID number

taskkill   -pid 15348 -f

Guess you like

Origin blog.csdn.net/Gabriel_wei/article/details/130796212