New to the forum, and new to the batch world.
Looking for any help I can get. I am attempting to build a batch file that will ping a list of IPs, and I would like it to automatically start pinging the IP's I have listed in another file.
This is what I have so far:
Code: Select all
ping -a -n 1 %1 |findstr "Reply from" >> ping.log
echo %ERRORLEVEL%
if errorlevel==1 goto notgood
if errorlevel==0 goto good
:notgood
echo %1 is not pingable >> ping.log
goto end
:good
echo %1 is good >> ping.log
goto end
:end
echo ---------------------- >> ping.log
Is there a way to open a batch file, have it automatically change the directory to the Desktop, and run the one command to execute the batch file?
This is the command that I run to run the batch file
Code: Select all
for /f %z in (pingip.txt) do pinghosts.bat %z