|
Answer» I need to ping google.com, if i get a time out i need to have the bat FILE run all of the commands http://support.microsoft.com/kb/289256/en-us . i have been trying to figure out how to do this on my own. but with school starting it have been hard to find free time. i am trying to have the bat file ping an ip address, export the results to a txt file. then i want to use a if statement to find "Received = 3". if it finds that string then exit and take no action. if it doesnt find that string i want it to run the repair commands that are at the website above. or if there is an easier way to do this i would appreciate it. but that is what i was thinking would work. sorry, I am new at forums... If you need more info LET me know. thanks!Why received = 3? Why not 4? On my PC ping sends 4 packets. You don't need a text file. Why bother with a packet COUNT? You can just use || to see if the ping was unsuccessful.
ping www.google.com>nul || ( echo Google did not answer REM repair code here )
thankyou very much. that helped so much.One more note on this: You may want to find something different to ping. Like something on the internet that you control, so you know it will be there and allow ICPM echo requests. There is a good chance that Google will block ICMP echo requests at some point in the future, especially if more people start using it to ping for a TEST like yours. If enough computers ping google, it can be the equivalent of a DDOS attack on google.com at which point they will block it for sure. You may notice that many large sites already block ICMP echo, like www.microsoft.com. If you try to ping www.microsoft.com it will fail, even though it EXISTS because ICMP echo is blocked.
|