One way to do this is to place the URLS in a text file as follows:
www.google.com
www.yahoo.com
Then run the next batch
for /f %%a in (%1) do ( echo Pinging %%a... ping %%a )
and run it from cmd as pingme.bat URLs.txt
Alternatively, you can specify the name of the text file in the package and run it without a parameter
for /f %%a in (URLs.txt) do ( echo Pinging %%a... ping %%a )
Here is a different approach
This particular batch will pull from the list and write to output.txt if ping was successful
@ECHO OFF SET output=output.txt IF EXIST "%output%" DEL "%output%" FOR /f %%a IN (URLs.txt) DO ( CALL :ping %%a ) GOTO :EOF :ping ping -n 1 %1 | find "Approximate round trip" >NUL || ECHO %1>>"%output%"
We hope this helps you in the right direction.
Michael capobianco
source share