|
Answer» Hey all batch-writing masters!
I'm trying to see if I can record the millisecond trip time that a ping takes to a specificied address, and then after a certain amount of pings to get the average. Getting the average is the easy part, but I'm not sure how to capture the above information.
For example, I use the following ping command and get the following RESPONSE: -------------------------------------------------- PING -n 1 YAHOO.com
Pinging yahoo.com [XXX.XXX.XXX.XXX] with 32 bytes of data: Reply from XXX.XXX.XXX.XXX: bytes=32 time=68ms TTL=53
Ping statistics for XXX.XXX.XXX.XXX: PACKETS: Sent = 1, Received = 1, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 68ms, Maximum = 68ms, Average = 68ms ---------------end response---------------
I want to pull the "time=" or any of the times on the last LINE. Let me know if this can be done. Thanks!I changed the NUMBER of times (20) to ping the yahoo website. Using the results of a single ping will skew the result if it's far above or far below the actual average.
Code: [Select]echo off for /f "tokens=3 delims=," %%i in ('ping -n 20 yahoo.com ^| find /i "average"') do echo %%i
|