Skip to content

Instantly share code, notes, and snippets.

@ariesmcrae
Last active May 27, 2017 05:47
Show Gist options
  • Save ariesmcrae/4d50d4afba030233a8f9 to your computer and use it in GitHub Desktop.
Save ariesmcrae/4d50d4afba030233a8f9 to your computer and use it in GitHub Desktop.
Windows batch file what will ping all servers in servers.txt and will output offline.txt if the server can't be pinged. It can't discriminate between server-not-found or server-is-down.
@echo off
del log.txt 2>nul
for /f "delims=" %%a in (servers.txt) do ping -n 2 %%a >nul && (
>>online.txt echo %%a&echo %%a online) || (
>>offline.txt echo %%a&echo %%a offline)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment