Friday, December 7, 2018

batch file command check network connection to server

Recently try to build a automation batch file program, before execution, need to test network connectivity to server: If server are not reachable, batch file will not execute. So I did simple search from Internet. Sample code from an Internet post, give me an idea to continue:
ping -n 1 192.168.1.1 | find "TTL=" >nul
if errorlevel 1 (
echo Server not reachable

) else (
echo Server reachable

)
contact writer: Ngai Siew Kuen
e-mail:s_k_ngai
Subject:[From Blog]batch file command check network connection to server