Skip to content

Instantly share code, notes, and snippets.

@vishalkardode
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save vishalkardode/a213315cc97d2eabff44 to your computer and use it in GitHub Desktop.

Select an option

Save vishalkardode/a213315cc97d2eabff44 to your computer and use it in GitHub Desktop.
Ping TestPings servers from text file and exports results to another text
127.0.0.1
172.21.32.179
@echo off
REM @author Vishal
if exist computers.txt goto Label1
echo "Cannot find computers.txt"
Pause
goto :eof
:Label1
echo PingTest executed on %date% at %time% > z.txt
for /f %%i in (computers.txt) do call :Sub %%i
goto :eof
:Sub
echo Testing %1
set state=alive
ping -n 1 %1 | find /i "bytes=" || set state=dead
echo %1 is %state% >> z.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment