我想用批处理判断某端口的状态,具体说是这样,首先我通过netstat -an可以行到当前网络连接表,例如这里
-
- C:\Documents and Settings\Administrator>netstat -an
- Active Connections
- Proto Local Address Foreign Address State
- TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
- TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
- TCP 0.0.0.0:1025 0.0.0.0:0 LISTENING
- TCP 0.0.0.0:3389 0.0.0.0:0 LISTENING
- TCP 10.104.150.74:139 0.0.0.0:0 LISTENING
- TCP 10.104.150.74:1776 174.36.30.67:443 CLOSE_WAIT
- TCP 10.104.150.74:1778 75.101.149.195:443 CLOSE_WAIT
- TCP 10.104.150.74:1780 208.43.202.2:80 ESTABLISHED
- TCP 10.104.150.74:1782 174.36.30.66:443 CLOSE_WAIT
- TCP 10.104.150.74:1924 174.36.30.66:443 ESTABLISHED
- TCP 10.104.150.74:1925 75.101.139.43:443 ESTABLISHED
复制代码
我想判断远程端口443的几个状态是否有ESTABLISHED的,如果有就循环判断,直到没有ESTABLISHED为止,我大概知道是用findstr和if来处理,但具体怎样写不会了,有大大可以指导下吗? |