Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
There is a program that runs on a remote PC which does some telnet work via a script, then sends the session log to a text file. Depending on the speed of the telnet session (it's using TST10.exe), the formatting is sometimes different (usually the slower connections). I'm hoping to create a batch file that can send several pings to the device being telnetted into, add the response times together, then give an average response time. The parsing part is done:
@echo off
set IP=127.0.0.1ping %IP% -n 1 -w 3000>.\DetermineSpeed1.txt
ping %IP% -n 1 -w 3000>.\DetermineSpeed2.txt
ping %IP% -n 1 -w 3000>.\DetermineSpeed3.txt
ping %IP% -n 1 -w 3000>.\DetermineSpeed4.txtfor /f "tokens=3 delims==" %%a in ('type .\DetermineSpeed1.txt ^| find "time"') do set One=%%a
for /f "tokens=3 delims==" %%a in ('type .\DetermineSpeed2.txt ^| find "time"') do set Two=%%a
for /f "tokens=3 delims==" %%a in ('type .\DetermineSpeed3.txt ^| find "time"') do set Three=%%a
for /f "tokens=3 delims==" %%a in ('type .\DetermineSpeed4.txt ^| find "time"') do set Four=%%afor /f "tokens=1 delims= " %%a in ('echo %One%') do set One=%%a
for /f "tokens=1 delims= " %%a in ('echo %Two%') do set Two=%%a
for /f "tokens=1 delims= " %%a in ('echo %Three%') do set Three=%%a
for /f "tokens=1 delims= " %%a in ('echo %Four%') do set Four=%%afor /f "tokens=1 delims=m" %%a in ('echo %One%') do set One=%%a
for /f "tokens=1 delims=m" %%a in ('echo %Two%') do set Two=%%a
for /f "tokens=1 delims=m" %%a in ('echo %Three%') do set Three=%%a
for /f "tokens=1 delims=m" %%a in ('echo %Four%') do set Four=%%aecho First ping response : %one%
echo Second ping response: %two%
echo Third ping response : %three%
echo Fourth ping response: %four%del .\DetermineSpeed1.txt
del .\DetermineSpeed2.txt
del .\DetermineSpeed3.txt
del .\DetermineSpeed4.txt
pause
goto:EOFNow I just need to find a way to do the math of adding them together and dividing by the number of pings to find the average. Any takers on this challenge? :)

Wow, I'm a complete knucklehead not to have figured this out.
set /a sum=%one%+%two%+%three%+%four%
echo.
echo Sum: %sum%set /a average=%sum%/4
echo.
echo Average: %average%
echo.Wheee!

@echo off
setLocal EnableDelayedExpansionfor /f "tokens=4 delims==" %%a in ('ping computing.net ^|find " Average"') do (
echo %%a
)
=====================================
If at first you don't succeed, you're about average.M2

![]() |
ASP forms
|
WSH: Delete files in fold...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |