I have a first loop and a second loop but the variable from the first loop always stays the same in the second loop. how do i get the actual value of the second loop?
REM @echo off
set fastestserver=none
set fastestresponse=99999999ms
for /F "tokens=*" %%A in (fileservers.txt) do (
for /F "skip=8 tokens=9 delims= " %%B in ('ping -n 3 %%A') do (
echo %%A
echo %%B
set fastestresponse=%%B
set actualpingserver=%%B
if /I "%fastestresponse:~,-2%" GTR "%actualpingserver:~,-2%" (
set fastestresponse=%%B
set fastestserver=%%A
)
)
)
REM @echo on
echo %fastestserver%
echo %fastestresponse%
in the fileserver.txt there are some servers inside, each get pinged and i want to get the average ping, if the ping is smaller then of the one before it should replace the 2 variables (fastestserver , fastestresponse ).
Problem now is that if i debug the script it always takes for
if /I "%fastestresponse:~,-2%" LSS "%actualpingserver:~,-2%"
so somehow from the second for the fastestresponse does not get filld because the value is always 999999999ms.
Thanks already for a hint/helping answer