How can you find out which process is listening on

2018-12-31 04:17发布

How can you find out which process is listening on a port on Windows?

26条回答
笑指拈花
2楼-- · 2018-12-31 04:49

Just open a command shell and type : (saying your port is 123456)

netstat -a -n -o | find "123456"

You will see everything you need

The headers are :

 Proto  Local Address          Foreign Address        State           PID
 TCP    0.0.0.0:37             0.0.0.0:0              LISTENING       1111

this is as mentioned here

查看更多
栀子花@的思念
3楼-- · 2018-12-31 04:49

Use below batch script which takes a process name as argument and gives netstat output for the process.

@echo off
set procName=%1
for /f "tokens=2 delims=," %%F in ('tasklist /nh /fi "imagename eq %1" /fo csv') do call :Foo %%~F
goto End

:Foo
set z=%1
echo netstat for : "%procName%" which had pid "%1"
echo ----------------------------------------------------------------------

netstat -ano |findstr %z%
goto :eof

:End
查看更多
泪湿衣
4楼-- · 2018-12-31 04:51
netstat -aon | find /i "listening"
查看更多
荒废的爱情
5楼-- · 2018-12-31 04:53

There's a native GUI for Windows:

  • Start>>All Programs>>Accessories>>System Tools>>Resource Monitor

or Run resmon.exe, or from TaskManager performance tab

enter image description here

查看更多
临风纵饮
6楼-- · 2018-12-31 04:53

netstat -a -o This shows the PID of the process running on a particular port.

Keep in mind the process id and go to Task manager and services or details tab and end the process which has the same PID.

Thus you can kill a process running on a particular port in windows.

查看更多
倾城一夜雪
7楼-- · 2018-12-31 04:53

Netstat -a displays all connection and listening ports -b displays executables -n stop resolve hostnames (numerical form) -o owning process

netstat -bano | findstr "7002"

netstat -ano > ano.txt 

Currports helps to search and filter

查看更多
登录 后发表回答