在 window 里面杀死某个进程

2016-11-22 Oliver Wang 更多博文 » 博客 » GitHub »

端口占用

原文链接 http://ochukai.me/kill-process-in-window/
注:以下为加速网络访问所做的原文缓存,经过重新格式化,可能存在格式方面的问题,或偶有遗漏信息,请以原文为准。


查看被谁占用

netstat -ano | findstr 8989

# C:\Users\Administrator>netstat -ano | findstr 8989
#   TCP    0.0.0.0:8989           0.0.0.0:0              LISTENING       6360
#   TCP    [::]:8989              [::]:0                 LISTENING       6360
#   TCP    [::1]:8989             [::1]:53638            ESTABLISHED     6360
#   TCP    [::1]:8989             [::1]:53640            ESTABLISHED     6360
#   TCP    [::1]:8989             [::1]:53641            ESTABLISHED     6360
#   TCP    [::1]:8989             [::1]:53645            ESTABLISHED     6360
#   TCP    [::1]:8989             [::1]:53646            ESTABLISHED     6360
#   TCP    [::1]:8989             [::1]:53652            ESTABLISHED     6360
#   TCP    [::1]:8989             [::1]:53653            ESTABLISHED     6360
#   TCP    [::1]:8989             [::1]:53654            ESTABLISHED     6360
#   TCP    [::1]:53638            [::1]:8989             ESTABLISHED     5440
#   TCP    [::1]:53640            [::1]:8989             ESTABLISHED     5440
#   TCP    [::1]:53641            [::1]:8989             ESTABLISHED     5440
#   TCP    [::1]:53645            [::1]:8989             ESTABLISHED     5440
#   TCP    [::1]:53646            [::1]:8989             ESTABLISHED     5440
#   TCP    [::1]:53652            [::1]:8989             ESTABLISHED     5440
#   TCP    [::1]:53653            [::1]:8989             ESTABLISHED     5440
#   TCP    [::1]:53654            [::1]:8989             ESTABLISHED     5440
tasklist | findstr 8989//查看pid为3036的是什么程序在用

杀死某进程

# /T 包括子进程
# /F 强制

taskkill /T /F /PID 8989