Last active
July 18, 2017 12:21
-
-
Save mansouryaacoubi/4689189a114fa7bd336fe902072d0c9e to your computer and use it in GitHub Desktop.
Continuous host reachability check (Batch on Windows using Ping)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
set url=%1 | |
mode con cols=70 lines=1 | |
color 37 | |
::color 17 | |
:check | |
IF %url%. EQU . ( | |
set /P url=Host: | |
goto check | |
) | |
:loop | |
ping %url% -n 1 2>&1 > nul | |
set EL=%ERRORLEVEL% | |
cls | |
IF %EL% EQU 0 <nul set /p =[SUCCESS] Host (%url%) reachable | |
IF %EL% EQU 1 <nul set /p =[ERROR ] Host (%url%) unreachable | |
timeout 1 2>&1 > nul | |
goto loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment