Please read this explanation before attempting debugging challenges.
When I run my batch script it tells me always "success" or always "failed", but obviously it shouldn't always be. What's wrong?
@echo off set iplist= set iplist=%iplist% 127.0.0.1 set iplist=%iplist% 192.168.1.1 set iplist=%iplist% 172.16.11.6 set iplist=%iplist% 10.0.11.125 set iplist=%iplist% 8.8.8.8 set iplist=%iplist% 172.16.11.3 set iplist=%iplist% 123.123.123.123 set iplist=%iplist% 8.8.4.4 set iplist=%iplist% 1.2.3.4 set iplist=%iplist% 172.16.11.250 for %%p in (%iplist%) do ( echo ###%%p### echo ###%%p### >> PingLog.txt ping -a -n 1 %%p >> PingLog.txt if %errorlevel%==0 ( echo ..Ping Successful to %%p ) else ( echo ..Ping Failed to %%p ) )
Downloadable source code can be found here.