Home > database >  Windows batch program, processing judgment Telnet remote PC, whether the port
Windows batch program, processing judgment Telnet remote PC, whether the port

Time:11-20

@ echo off
Start Telnet. Exe 171.24.21.45 1433
Ping - n 5 127.1 & gt; Nul
Tasklist | find/I "Telnet. Exe" & gt; Nul
IF ERRORLEVEL 1 GOTO err
GOTO ok IF ERRORLEVEL 0

: err
Echo CRITICAL: Port check failed
Pause
The exit/B 2

: ok
Echo OK: Port check succeded
Taskkill IM/F/Telnet. Exe & gt; Nul
Pause
The exit/B 0
The above code from justin_peng 51 cto blog, the original links: http://blog.51cto.com/ityunwei2017/1924966
The above code is used to deal with this problem, but the effect only once, and then every judgment is successful, can't solve this problem, hope someone can help me have a look at the problem, of course it's better if can solve this problem, thank you for your attention
  • Related