如下:
查询监听LISTENING的端口1027
netstat -navo|find /i "listen"|find /i ":1027"
结果如下(最后一列是进程id):
C:UsersAdministrator>netstat -navo|find /i "listen"|find /i ":1027" TCP 0.0.0.0:1027 0.0.0.0:0 LISTENING 888 TCP [::]:1027 [::]:0 LISTENING 888
查询连接状态ESTABLISHED的进程
例如:查询连接到mysql数据库3306端口的进程
C:UsersAdministrator>netstat -navo|find /i "ESTABLISHED"|find /i ":3306" TCP 127.0.0.1:3306 127.0.0.1:7140 ESTABLISHED 1644 TCP 127.0.0.1:7140 127.0.0.1:3306 ESTABLISHED 8076