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
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)
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.
Summary: Batch file, ping results I want to run something similar at command prompt and display a custom message ping www.ebay.com.at if ping results == "could not found host" ECHO "My custom processing and me...
Summary: Hello, I am kindly looking for a batch file that will do the following. 1. I have a list of 10 PC names in a text file (pcnames.txt) 2. I want to ping every PC name in the list 3. If the ping fails th...
Summary: I need a sample batch file that will ping several servers and send the results to a log file, with a time stamp as well. If possible, it would be great if all i had to do was just plug in the IP add...