首页 > 代码库 > Windows下查询指定端口进程,并杀死

Windows下查询指定端口进程,并杀死

1. 找到指定端口的进程号

c:\devworks\lib\httpd-2.4.10-win32-VC9\Apache24\bin>netstat -ano|findstr "9000"  TCP    0.0.0.0:9000           0.0.0.0:0              LISTENING       4916  TCP    127.0.0.1:63189        127.0.0.1:9000         TIME_WAIT       0  TCP    127.0.0.1:63214        127.0.0.1:9000         TIME_WAIT       0  TCP    [::]:9000              [::]:0                 LISTENING       4916

2. 找到进程号对应的app

c:\devworks\lib\httpd-2.4.10-win32-VC9\Apache24\bin>tasklist | findstr "4916"javaw.exe                     4916 Console                    1    433,228 K

3. kill进程

c:\devworks\lib\httpd-2.4.10-win32-VC9\Apache24\bin>taskkill /f /t /im javaw.exeSUCCESS: The process with PID 4916 (child process of PID 6480) has been terminated.

Windows下查询指定端口进程,并杀死