Hello,
i am quite new to creating batch files but in my line of work i am required to ping alot of machines on a daily basis.
i have copied a previous batch file i found on here which is working fantastic. However i am wanting to edit it to only output if the ping failed. i have googled around but i am unable to find the write strings to change the output to just output fails to the
txt file.
See below
@echo off
Echo pingtest executed on %date% at %time% > c:\pingtest\output.txt
Echo == >> c:\pingtest\output.txt
for /f %%i in C:\pingtest\input.txt to call :sub %%i
Notepad c:\pingtest\output.txt
goto :eof
:sub
echo testing %1
Set state=alive
ping -n 1 %1
if errorlevel 1 set state=dead
Echo %1 is %state% >> c:\pingtest\output.txt