Im trying to go through at list of computer in batch file to verify they are up and running.
Im using this little batch snippet for it.
@echo off
for /F "tokens=*" %%A in (computerlist.txt) do (
ping /n 1 "%%A"
if %errorlevel% == 0 echo %%A online
if %errorlevel% == 1 echo %%A offline
)
however it seems to always report back "online"
Ive tried putting in echo %errorlevel% right after the ping command and it always response 0
however if i ctrl+c'ed a previously batch run and run the batch again withing the same command box. Its reports -1047something something
What am i doing wrong ?