title: How to Use an Environment Variable as an Environment Variable Name
body: <p>In my pursuit of a solution to another environment-variable/batch-file related problem, I have once again come across a problem I have visited before (but cannot for the life of me remember how, or even <em>if</em> I solved it).</p>
  
  <p>Say you have two BAT files (or one batch file and the command line). How can one pass an environment variable name to the other so that it can read the variable? The following example does not work:</p>
  
  <pre><code>A.BAT:
    @call b.bat path
  
  B.BAT:
    @echo %%1%
  
  &gt; A.BAT
  &gt; %1
  &gt; B.BAT path
  &gt; %1
  </code></pre>
  
  <p>It is easy enough to pass the environment variable name, but the callee cannot seem to use it. (I don’t remember if or how I dealt with this the last time it came up, but I suspect it required the less-than-ideal use of redirecting temporary BAT files and calling them and such.)</p>
  
  <p>Any ideas? Thanks.</p>