title: How to modify environment variable value inside a loop?
body: <p>I have following code in a batch file:</p>
  
  <pre><code>set "start=2"
  
  FOR /L %%a in (1,1,3) DO (
      FOR /L %%b in (%start%,1,3) DO (
          echo %start% Before Call
          call :changestring
          FOR /L %%c in (1,1,3) DO (
              REM Nothing
          )
      )
  )
  
  pause
  Goto :Eof
  
  :changestring
  echo %start% Before Set
  set "start=1"
  echo %start% After Set
  pause
  goto :eof
  </code></pre>
  
  <p>What I want is that value of variable <code>start</code> referenced twice in second <strong>FOR</strong> loop with <code>%start%</code> changes from <code>2</code> to <code>1</code> after running subroutine <code>changestring</code> with the command line <code>call :changestring</code>.</p>
  
  <p>The value of the environment variable <code>start</code> is modified in subroutine from <code>2</code> to <code>1</code> as output by the two <code>echo</code> command lines in subroutine. But in the second <strong>FOR</strong> loop the value is always <code>2</code> and does not change.</p>
  
  <p>How to modify value of environment variable <code>start</code> on second <strong>FOR</strong> loop?</p>