@echo off
setlocal enabledelayedexpansion
set IPERF_DIR=%~dp0iperf
set IPERF_EXE=%IPERF_DIR%\iperf3.exe
set SERVER=test.fortex.ru

set START_DATE=%date%
set START_TIME=%time%
echo iPerf3 speed test
echo Start: %START_DATE% %START_TIME%
echo.

echo Testing download speed...
for /f "tokens=7" %%A in ('%IPERF_EXE% -c %SERVER% -R ^| findstr /R "[0-9]*.[0-9]* Mbits/sec"') do set DOWNLOAD=%%A
echo Download: !DOWNLOAD! Mbit/s
echo.

echo Testing upload speed...
for /f "tokens=7" %%A in ('%IPERF_EXE% -c %SERVER% ^| findstr /R "[0-9]*.[0-9]* Mbits/sec"') do set UPLOAD=%%A
echo Upload: !UPLOAD! Mbit/s
echo.

set END_DATE=%date%
set END_TIME=%time%

echo Test finished at: %END_DATE% %END_TIME%
echo.
echo Test performed against server: %SERVER%
echo.
pause
