Windows Batch: Automatic check of network connectivity

Source: Internet
Author: User
Tags delete cache

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.