title: How to expand environment variable inside string read from file?
body: <p>I have a file with a list of paths. Some of them might include environment variables such as <code>%USERPROFILE%</code>.</p>
  
  <p>Example:</p>
  
  <pre><code>%USERPROFILE%\dir
  C:\another\dir
  </code></pre>
  
  <p>I'm then reading all the lines and concatenating with <code>;</code> using this code (the cat and tr commands are available because of git):</p>
  
  <pre><code>set include_file=C:\path\to\file.txt
  for /f "delims=" %%i in ('cat %include_file% ^| tr "\\n" ";"') do set include_content=%%i
  </code></pre>
  
  <p>This creates a variable with the string <code>%USERPROFILE%\dir;C:\another\dir</code>
  Normally running <code>echo %USERPROFILE%</code> would give you something like <code>C:\Users\xxx\dir</code> but running it with <code>%include_content%</code> just outputs the original string without expanding <code>%USERPATH%</code></p>
  
  <p>My final plan is to add the directories to my PATH like this <code>set PATH=%include_content%;%PATH%</code> but this doesn't work since the variable isn't expanded.</p>
  
  <p>My question is can I somehow expand the variables in the string so that the real directories get added to the path?</p>