1.

Solve : Please assist with a small script?

Answer»

I have a small script that I got from the net. This script basically reads the information (ip addresses) from a file and pings them and then inserts the results a text file. This script does exactly what I need but the issue is that instead of ping I need “pathping” which I change in the script. The issue is that during pathping if there is a delay the script sits for like 3 minutes or maybe 5 MINUTE depending on the response.

All I want is some KIND of time out basically maybe like 20 sec and move to the next record regardless of what the response is. Can someone please modify the script below so that the pathping command waits for like 30 sec and then move to the next row of information. Any tips or direction would be appreciated…Thanks

@echo off
cls
echo PathPing test in progress...

for /F %%i in (iplist.txt) do pathping %%i >> result.txt

echo .
echo .
echo Result is ready.Thank you very much.
*Will the -w (timeout) switch option help you here.
Quote

-w timeout Wait timeout milliseconds for each reply.

Such as 5000 millisecond timeout window to timeout after 5 sec with no response?

Quote
for /F %%i in (iplist.txt) do pathping -w 5000 %%i >> result.txt

C:\>pathping /?

Usage: pathping [-g host-list] [-h maximum_hops] [-i address] [-n]
[-p period] [-q num_queries] [-w timeout] [-P] [-R] [-T]
[-4] [-6] target_name

Options:
-g host-list Loose source route along host-list.
-h maximum_hops Maximum number of hops to search for target.
-i address Use the specified source address.
-n Do not resolve addresses to hostnames.
-p period Wait period milliseconds between pings.
-q num_queries Number of queries per hop.
-w timeout Wait timeout milliseconds for each reply.
-P Test for RSVP PATH connectivity.
-R Test if each hop is RSVP aware.
-T Test connectivity to each hop with Layer-2 priority tags.
-4 Force using IPv4.
-6 Force using IPv6.Thanks for the reply. Correct though there is a w (timeout FEATURE) but it would wait for certain time (e.g 250 sec) before MOVING to the next IP. I would like it to move to the next IP right away if there is a delay of more then 10 - 15 sec...Thanks.-p period - Wait period milliseconds between pings.

-w timeout - Wait timeout milliseconds for each reply.

When -p is specified, pings are sent individually to each intermediate hop. When -w is specified, multiple pings can be sent in parallel. It's therefore possible to choose a Timeout parameter that is less than the wait Period * Number of hops.

so i think "pathping -p 15000" this will work. Try this
(15000ms i.e 15 sec)


Discussion

No Comment Found