i want to make a batch file to ping an ip.
it must have 4 conditions.

1: if destination ip is reach able then it should display "host reachable"
2: if destination ip not reachable then it should display "host not reachable"
3: if request times out then it should display "timed out"
4: if any other error then it should display "undetected error"

i am able to make batch file for first two conditions, but how to trace request timed out.
any body can help regarding this? thanks.

this code i am using

@echo off
echo pinging...
PING xx.xx.xx.xx | find "TTL"
if errorlevel 1 (
    echo host not reachable
) else (
if errorlevel 0 (
    echo host reachable
)
)
pause
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.