Skip to content

Instantly share code, notes, and snippets.

@WizardCity
Created August 4, 2016 15:27
Show Gist options
  • Save WizardCity/1bc3e79836b7d7b49285d7406f443d7e to your computer and use it in GitHub Desktop.
Save WizardCity/1bc3e79836b7d7b49285d7406f443d7e to your computer and use it in GitHub Desktop.
A simple cmd network connection test which writes out to a file
@echo off
: Start
SET PT=%Date% %Time%
ping ww.google.ie -n 1 -w 3000 | find "TTL=" >nul
if errorlevel 1 (
COLOR 4E
::echo Cannot connect to Internet
echo %PT% --------Not Connected--------- >> failurelog.txt
echo %PT% --------Not Connected--------- >> Ping.txt
timeout 5 > NUL
) else (
COLOR 20
::echo All is Good
echo %PT% >> Ping.txt
ping www.google.com -n 5 -w 3000| FIND "TTL=" >> Ping.txt
echo( >> Ping.txt
timeout 3 > NUL
)
GOTO Start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment