Computing.Net > Forums > Programming > batch files , 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 files , ping results

Reply to Message Icon

Name: haresh7263
Date: October 15, 2006 at 17:36:08 Pacific
OS: xp
CPU/Ram: p4 1gb
Product: ibm
Comment:

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 message"
else if ping results == "request time out"
ECHO "My custom processing and message"
else ECHO "My custom processing and message"

if some one could provide the code :)

haresh7263 AT hotmail.com

Knowledge is meant to to shared



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: October 15, 2006 at 23:11:12 Pacific
Reply:

In my version of ping there are three main messages:

Unknown host
Reply from
Request timed out

What exact messages do you get?



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

M2



0

Response Number 2
Name: Guy
Date: October 16, 2006 at 19:09:03 Pacific
Reply:

The "timeout" message does not mean a lot in general.

The host *could* be there, serving something at some particular port.

It could just be dropping the ping ICMP packets on the floor. I have set up systems like that.

Guy



0

Response Number 3
Name: haresh7263
Date: October 17, 2006 at 19:58:07 Pacific
Reply:

Hello Mechanix2Go,

what i want is to differentiate (interprete) the ping results within the code. And depending on the ping results, execute the business logic.

Can you give me the exact syntax (code), how to interprete the ping results in code. Please refer to my psuedo code above.

Thanks in advance

Haresh

Knowledge is meant to to shared


0

Response Number 4
Name: Mechanix2Go
Date: October 19, 2006 at 05:12:58 Pacific
Reply:

@echo off

ping somesite2a2.com > %TEMP%\pinglog

find "Unknown host" < %TEMP%\pinglog > nul
if not errorlevel 1 echo custom msg1 && goto :eof

find "Reply from" < %TEMP%\pinglog > nul
if not errorlevel 1 echo custom msg2 && goto :eof

find "Request timed out" < %TEMP%\pinglog > nul
if not errorlevel 1 echo custom msg3 && goto :eof



=====================================
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 files , ping results

Batch file, ping results www.computing.net/answers/programming/batch-file-ping-results/14033.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