Detecting network Connectivity I'm using the Cong approach, which is"External Network--Gateway--Intranet--This machine", the implementation of the script is also based on this orderPingto detect, in order to improve the detection speed, here I onlyPingthe2times, you can make changes according to your own needs.
How to use the great gods will ... copy code, save as . Bat after the file is executed.
@echo offcolor 2Ftitle Network Connectivity Detection echo.echo.ping -n 2 223.5.5.5>%temp%\1.ping & ping -n 2 223.6.6.6>>%temp%\1.ping :: Ping Ali public dnsfindstr "TTL" %temp%\1.ping>nulif %errorlevel%==0 (echo √ External network Normal) else (echo x outside network) :: Output ECHO.PING -N 2 192.168.1.1>%TEMP%\2.PINGFINDSTR based on return value "TTL" %temp%\2.ping>nulif %errorlevel%==0 (echo √ Gateway Normal) else (echo x Gateway) echo.ping -n 2 192.168.1.2 >%temp%\3.pingfindstr "TTL" %temp%\3.ping>nulif %errorlevel%==0 (echo √ Normal network) else (echo x intranet) Echo.ping -n 2 127.0.0.1>%temp%\4.pingfindstr "TTL" %temp%\4.ping>nulif %errorlevel%==0 (echo √  TCP/IP protocol Normal) else (ECHO     X TCP/IP protocol exception) If exist %temp %\*.ping del %temp%\*.ping :: Delete cache files Echo.echo.pause
The effect is as follows:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/9C/wKiom1W5846ilqGmAADTlId_Kos005.jpg "title=" 1.png " alt= "Wkiom1w5846ilqgmaadtlid_kos005.jpg"/>
This article is from "Ops rookie. Log" blog, make sure to keep this source http://sjy000.blog.51cto.com/8412654/1680241
Windows Batch: Automatic check of network connectivity