Computing.Net > Forums > Programming > Batch file, ping results

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch file, ping results

Reply to Message Icon

Name: samsayit
Date: March 2, 2006 at 10:08:09 Pacific
OS: Windows Server 2003 x64
CPU/Ram: AMD64X2 4400+ / 3GB RAM
Product: Egg
Comment:

Is it possible in a BAT file to perform a ping, and then
- if the ping times out perform additional commands
- else do nothing
?

This post was by mistake posted in the wrong section (http://www.computing.net/windows2003/wwwboard/forum/5173.html)



Sponsored Link
Ads by Google

Response Number 1
Name: shahramsh
Date: March 2, 2006 at 16:22:37 Pacific
Reply:

How abou this:

@echo off
for /f "delims=." %%I in ('ping -n 1 www.ebay.com') do if "%%I"=="Request timed out" (echo Hello)


Replace www.ebay.com with whatever you want to check


0

Response Number 2
Name: samsayit
Date: March 2, 2006 at 16:32:47 Pacific
Reply:

It doesnt seem to work. I put in a fake URL in my hosts, so I know it will time out because it cannot be reached. However nothing happens when running the script.


0

Response Number 3
Name: shahramsh
Date: March 2, 2006 at 16:48:14 Pacific
Reply:

well for me, www.ebay.com also times out, and the command at the end which is "echo hello" is executed,

check your url direcly with ping and check if it results exactly in :
"Request timed out."

and if u r checking it from the command line and not from a batch file don't forget "%%I" should be "%I"


0

Response Number 4
Name: Mechanix2Go
Date: March 2, 2006 at 23:13:54 Pacific
Reply:

Works for me.


If at first you don't succeed, you're about average.

M2


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch file, ping results

batch files , ping results www.computing.net/answers/programming/batch-files-ping-results/14790.html

Batch File - Ping > Send Command www.computing.net/answers/programming/batch-file-ping-send-command/16434.html

Batch file to ping several servers. www.computing.net/answers/programming/batch-file-to-ping-several-servers/13545.html