windows杀死某个端口对应的进程

  1. 找到端口(以1111端口为例)对应的PID
netstat -ano | findstr "1111"

console输出 :

D:Programs
edis>netstat -ano | findstr "1111"
  TCP    0.0.0.0:1111           0.0.0.0:0              LISTENING       3864
  TCP    127.0.0.1:1111         127.0.0.1:49559        CLOSE_WAIT      3864
  TCP    127.0.0.1:49559        127.0.0.1:1111         FIN_WAIT_2      5852
  TCP    [::]:1111              [::]:0                 LISTENING       3864

2.可以查看到底是哪个进程占用了这个端口, 如果只想kill 不需要查看该端口对应的进程的话,可以直接到step 3
3864是上面step 1通过查询端口得到的进程号;

tasklist | findstr 3864

console输出:

D:Programs
edis>tasklist | findstr 3864
java.exe                      3864 Console                    1  1,119,672 K

就知道是java.exe占用了该端口;

  1. 结束该进程:
    3864是上面step 1通过查询端口得到的进程号
taskkill -PID 3864 -F

console输出:

D:Programs
edis>taskkill -PID 3864 -F
SUCCESS: The process with PID 3864 has been terminated.
原文地址:https://www.cnblogs.com/kwzblog/p/14699921.html