title: How to recursively expand an environment variable?
body: <p>Assume the following:</p>
  
  <p><code>echo %MY_ENV_VAR%</code> expands to <code>%USERPROFILE%\some\path</code><br>
  <code>echo %USERPROFILE%</code> expands to <code>C:\Users\MyUser</code></p>
  
  <p>My goal is to create an empty file at the following path: <code>C:\Users\MyUser\some\path\FOO.txt</code>.</p>
  
  <p>I tried the following command: <code>type nul &gt; %MY_ENV_VAR%\FOO.txt</code></p>
  
  <p>Unfortunately the output is an error which states <em>The system cannot find the path specified.</em></p>
  
  <p>I'm pretty certain this is because the shell is not recursively expanding <code>%MY_ENV_VAR%</code> and it's trying to find a literal path that begins with <code>%USERPROFILE%</code>.   </p>
  
  <p>How can I best accomplish my goal?</p>