title: How to assign something to global variable from within FOR loop in batch
body: <p>I have some code, which is get some string from file and assign it to some variable. The variable will be used for different purpose in file:</p>
  
  <pre><code>setlocal EnableDelayedExpansion
  FOR /F "tokens=* USEBACKQ" %%F IN (`file.txt`) DO SET var1=%%F
  endlocal
  echo %var1%
  </code></pre>
  
  <p>I get empty <code>var1</code>. How can I extract string and use it for my purposes in different places?</p>