title: nested for loops with variable used in the nested loop windows batch
body: <p>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?</p>
  
  <pre><code>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%
  </code></pre>
  
  <p>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 ).</p>
  
  <p>Problem now is that if i debug the script it always takes for </p>
  
  <pre><code>if /I "%fastestresponse:~,-2%" LSS "%actualpingserver:~,-2%"
  </code></pre>
  
  <p>so somehow from the second for the fastestresponse does not get filld because the value is always 999999999ms.</p>
  
  <p>Thanks already for a hint/helping answer</p>