Win10 | 查找占用特定端口的进程

2018-06-18  本文已影响0人  shawn233

以解决80端口被占用为例。

第一步,用netstat指令查看是哪个进程占用了端口。

C:\Users\73936>netstat -aon|findstr 80
  TCP    0.0.0.0:80             0.0.0.0:0              LISTENING       4
  TCP    0.0.0.0:1309           0.0.0.0:0              LISTENING       4080
  TCP    0.0.0.0:7680           0.0.0.0:0              LISTENING       4752
  TCP    192.168.3.6:1271       52.230.85.180:443      ESTABLISHED     4052
  TCP    192.168.3.6:1435       180.149.145.241:80     LAST_ACK        3220
  TCP    192.168.3.6:1514       52.230.85.180:443      ESTABLISHED     9760
  TCP    192.168.3.6:1631       23.2.16.73:80          TIME_WAIT       0
  TCP    192.168.3.6:1636       23.2.16.73:80          TIME_WAIT       0
  TCP    192.168.3.6:1637       117.18.237.29:80       TIME_WAIT       0
  TCP    192.168.3.6:1638       23.2.16.73:80          TIME_WAIT       0
  TCP    192.168.3.6:1639       117.18.237.29:80       TIME_WAIT       0
  TCP    192.168.3.6:1666       23.2.16.73:80          TIME_WAIT       0
  TCP    192.168.3.6:1731       23.2.16.73:80          TIME_WAIT       0
  TCP    192.168.3.6:1774       23.2.16.73:80          TIME_WAIT       0
  TCP    192.168.3.6:1775       117.18.237.29:80       TIME_WAIT       0
  TCP    192.168.3.6:1780       23.2.16.73:80          TIME_WAIT       0
  TCP    192.168.3.6:1782       117.18.237.29:80       TIME_WAIT       0
  TCP    192.168.3.6:1806       192.168.3.8:139        TIME_WAIT       0
  TCP    192.168.3.6:1855       10.163.89.249:7680     SYN_SENT        4752
  TCP    192.168.3.6:1856       10.163.89.249:7680     SYN_SENT        4752
  TCP    192.168.3.6:1857       10.163.89.249:7680     SYN_SENT        4752
  TCP    [::]:80                [::]:0                 LISTENING       4
  TCP    [::]:7680              [::]:0                 LISTENING       4752
  TCP    [::1]:1680             [::]:0                 LISTENING       7708
  UDP    [fe80::7423:d8cf:62a7:d11c%11]:1900  *:*                                    5832
  UDP    [fe80::7423:d8cf:62a7:d11c%11]:55121  *:*                                    5832

在第2列可以找到,占用80端口的进程号为4。一看这个数字这么小,我预料到会有不好的事情发生。

第二步,用tasklist指令查找进程号对应的名称。

C:\Users\73936>tasklist|findstr 4
System                           4 Services                   0        140 K
Registry                        96 Services                   0     45,792 K
smss.exe                       348 Services                   0        932 K
csrss.exe                      504 Services                   0      5,572 K
wininit.exe                    628 Services                   0      6,764 K
services.exe                   676 Services                   0     11,460 K
fontdrvhost.exe                892 Services                   0      2,984 K
WUDFHost.exe                   960 Services                   0      7,084 K
svchost.exe                     76 Services                   0     15,364 K
svchost.exe                    384 Services                   0      8,516 K
svchost.exe                   1268 Services                   0      9,472 K
svchost.exe                   1276 Services                   0     11,428 K
svchost.exe                   1404 Services                   0     10,788 K
svchost.exe                   1412 Services                   0     15,492 K
svchost.exe                   1480 Services                   0     10,252 K
svchost.exe                   1524 Services                   0     18,240 K
svchost.exe                   1664 Services                   0      9,412 K
svchost.exe                   1884 Services                   0      7,360 K
svchost.exe                    416 Services                   0     23,116 K
svchost.exe                   2040 Services                   0     11,904 K
svchost.exe                   2132 Services                   0      9,384 K
svchost.exe                   2220 Services                   0     12,460 K
Memory Compression            2356 Services                   0     74,120 K
igfxCUIService.exe            2408 Services                   0      7,556 K
svchost.exe                   2452 Services                   0      7,640 K
svchost.exe                   2460 Services                   0      9,920 K
svchost.exe                   2592 Services                   0     12,744 K
svchost.exe                   2676 Services                   0     14,832 K
svchost.exe                   2708 Services                   0      8,244 K
svchost.exe                   2724 Services                   0      6,284 K
svchost.exe                   2980 Services                   0     17,624 K
svchost.exe                   3052 Services                   0     13,384 K
AsLdrSrv.exe                  3064 Services                   0      5,024 K
svchost.exe                   2140 Services                   0     21,828 K
spoolsv.exe                   2792 Services                   0     12,460 K
conhost.exe                   3288 Services                   0      4,644 K
svchost.exe                   3464 Services                   0      6,552 K
armsvc.exe                    3472 Services                   0      5,556 K
svchost.exe                   3480 Services                   0      8,612 K
CAJSHost.exe                  3488 Services                   0      4,972 K
svchost.exe                   3496 Services                   0     13,204 K
ASUSGiftBoxDesktop.exe        3504 Services                   0      5,828 K
AGMService.exe                3544 Services                   0     10,044 K
CxAudMsg64.exe                3552 Services                   0      7,896 K
AGSService.exe                3560 Services                   0     10,400 K
svchost.exe                   3580 Services                   0     22,724 K
esif_uf.exe                   3620 Services                   0      7,040 K
OfficeClickToRun.exe          3640 Services                   0     38,700 K
Everything.exe                3704 Services                   0      6,208 K
svchost.exe                   3784 Services                   0      9,020 K
EvtEng.exe                    3792 Services                   0     13,144 K
svchost.exe                   3940 Services                   0     11,972 K
RegSrvc.exe                   4028 Services                   0      8,844 K
svchost.exe                   4036 Services                   0      6,112 K
svchost.exe                   4052 Services                   0     20,304 K
jtagserver.exe                4080 Services                   0      7,692 K
inetinfo.exe                  3404 Services                   0     10,136 K
ibtsiva.exe                   4112 Services                   0      4,236 K
FlashHelperService.exe        4132 Services                   0      6,952 K
nvcontainer.exe               4140 Services                   0     23,004 K
SecurityHealthService.exe     4148 Services                   0     15,216 K
NVDisplay.Container.exe       4168 Services                   0      9,772 K
SASrv.exe                     4176 Services                   0      5,332 K
RichVideo64.exe               4184 Services                   0      6,388 K
IpOverUsbSvc.exe              4192 Services                   0     11,944 K
QQProtect.exe                 4200 Services                   0     18,232 K
ZeroConfigService.exe         4224 Services                   0     16,068 K
PEFService.exe                4276 Services                   0      7,152 K
MsMpEng.exe                   4288 Services                   0    271,288 K
TeamViewer_Service.exe        4484 Services                   0     10,712 K
IntelCpHeciSvc.exe            4564 Services                   0      9,016 K
svchost.exe                   4572 Services                   0      8,652 K
svchost.exe                   4664 Services                   0     16,384 K
dasHost.exe                   4772 Services                   0     16,164 K
svchost.exe                   5004 Services                   0     11,316 K
svchost.exe                   4316 Services                   0      6,876 K
svchost.exe                   3000 Services                   0      9,476 K
svchost.exe                   8684 Services                   0     18,248 K
SearchIndexer.exe             9564 Services                   0     44,328 K
svchost.exe                   9824 Services                   0     14,416 K
svchost.exe                  10196 Services                   0      9,864 K
svchost.exe                  10632 Services                   0      6,584 K
svchost.exe                  10984 Services                   0     18,968 K
svchost.exe                  10416 Services                   0     40,952 K
svchost.exe                   4752 Services                   0     17,896 K
sppsvc.exe                   10840 Services                   0     10,316 K
svchost.exe                   8744 Services                   0      8,340 K
isa.exe                      12336 Services                   0      8,348 K
svchost.exe                  10792 Services                   0      7,340 K
svchost.exe                  12928 Services                   0      8,704 K
audiodg.exe                  10884 Services                   0     15,952 K
svchost.exe                   3756 Services                   0     15,640 K
svchost.exe                   9476 Services                   0      7,144 K
svchost.exe                   5944 Services                   0      5,908 K
csrss.exe                    15912 Console                    8      5,844 K
fontdrvhost.exe               3180 Console                    8     45,708 K
svchost.exe                  15456 Services                   0     23,256 K
svchost.exe                  11416 Services                   0      6,888 K
HControl.exe                 10448 Console                    8      9,840 K
nvcontainer.exe               7724 Console                    8     27,948 K
sihost.exe                   15544 Console                    8     24,432 K
svchost.exe                   8904 Console                    8     33,212 K
taskhostw.exe                 2852 Console                    8     15,684 K
ACMON.exe                    13096 Console                    8      4,972 K
USBChargerPlus.exe            9140 Console                    8      2,500 K
esif_assist_64.exe            3668 Console                    8      3,784 K
svchost.exe                    524 Services                   0      6,956 K
ATKOSD2.exe                   9388 Console                    8      9,064 K
explorer.exe                  8348 Console                    8    137,184 K
ShellExperienceHost.exe      14040 Console                    8     68,616 K
SearchUI.exe                  6648 Console                    8    129,324 K
RuntimeBroker.exe            14992 Console                    8     20,872 K
RuntimeBroker.exe             6984 Console                    8     22,732 K
SettingSyncHost.exe          12164 Console                    8     12,420 K
RemindersServer.exe           1620 Console                    8     13,428 K
ctfmon.exe                   12840 Console                    8     24,284 K
SkypeHost.exe                14628 Console                    8     61,032 K
svchost.exe                  14696 Services                   0      7,952 K
RuntimeBroker.exe             6224 Console                    8     21,064 K
ChsIME.exe                    2260 Console                    8     35,540 K
WindowsInternal.Composabl     7584 Console                    8     45,392 K
conhost.exe                   6204 Console                    8      2,076 K
AsusHWCenter64.exe           11760 Console                    8      2,684 K
CAudioFilterAgent64.exe      12528 Console                    8      8,044 K
OneDrive.exe                  9760 Console                    8     46,208 K
rishiqing.exe                11640 Console                    8     40,644 K
rishiqing.exe                 4616 Console                    8    106,120 K
rishiqing.exe                 1208 Console                    8     51,148 K
DictQuerySync.exe             7476 Console                    8     13,256 K
Snipaste.exe                 14848 Console                    8     22,936 K
ONENOTEM.EXE                  8484 Console                    8      2,216 K
acrotray.exe                   456 Console                    8      8,004 K
Creative Cloud.exe            8040 Console                    8     68,312 K
AdobeIPCBroker.exe           14096 Console                    8     10,332 K
Adobe CEF Helper.exe          4536 Console                    8     53,616 K
CoreSync.exe                   612 Console                    8     29,848 K
conhost.exe                  10644 Console                    8      8,492 K
Adobe CEF Helper.exe          8428 Console                    8     48,856 K
svchost.exe                  14024 Services                   0     10,748 K
chrome.exe                    3968 Console                    8    380,460 K
chrome.exe                   11848 Console                    8      8,348 K
chrome.exe                    8556 Console                    8     40,676 K
chrome.exe                    8156 Console                    8    144,332 K
chrome.exe                    1552 Console                    8     48,872 K
chrome.exe                   14224 Console                    8     42,948 K
chrome.exe                   11472 Console                    8     40,564 K
chrome.exe                    9292 Console                    8     37,844 K
chrome.exe                   12876 Console                    8     46,252 K
steamcommunity_302_V5.exe    14396 Console                    8     14,296 K
chrome.exe                    1304 Console                    8    129,660 K
chrome.exe                    5040 Console                    8     21,340 K
svchost.exe                   9272 Services                   0     22,484 K
UpdateChecker.exe             1564 Console                    8     12,196 K
HxTsr.exe                    16284 Console                    8     39,156 K
findstr.exe                  15284 Console                    8      3,272 K

在以上这么多进程中,从第2列找到进程号为4的,发现是System。那就没有办法了,让它占着吧。这时我才意识到占用80端口的是Windows的Internet Information Service,要解决我这次80端口被占用看来只能关掉它。

当然上面出现的只是很少见的情况,大多数情况下我们会查到一个非系统进程。想要关掉这种进程,只需要在任务管理器中结束进程即可。

上一篇下一篇

猜你喜欢

热点阅读