hi,
I am looking for a script that will ping an ip address. If it does not get a reply i would then like it to run a batch file
Can anyone help please?
Thanks
Z

hi,
I am looking for a script that will ping an ip address. If it does not get a reply i would then like it to run a batch file
Can anyone help please?
Thanks
Z
Should work.Code:ping -n 1 -l 1 targetip if %errorlevel%==0 echo Host is up! if %errorlevel%==1 goto DOWN :DOWN Do stuff here And more stuff

Batch code, yep. Change targetip for whichever IP address you're wanting to check, and put the code you want to execute if it fails under the label.
In fact, thinking about it, this might be better -
Code:ping -n 1 -l 1 targetip if %errorlevel%==0 goto END Do stuff here And more stuff :END
FN-GM (22nd April 2009)
Could even use
ping -n 1 -l 1 targetip>NULL:
to supress feedback?
Use my No ping script & edit it slightly...
No Ping
E-mail me if you want the source.
There are currently 1 users browsing this thread. (0 members and 1 guests)