title: .bat batch file how to get environment variable from string?
body: <p>I have the name of an variable saved as a string (it will be read in from a CONFIG file).  I would like to evaluate this environment variable, to print its value to the console for example.  I am unsure of how to do this.</p>
  <p>My current script:</p>
  <pre><code>@echo off
  
  set env_var=VIVADO_BAT_PATH_2018_3
  
  set str=set vivado_bat_path=%env_var%
  %str%
  echo &quot;bat path:  %vivado_bat_path%&quot;
  
  set str=set vivado_bat_path=%%env_var%%
  %str%
  echo &quot;bat path:  %vivado_bat_path%&quot;
  </code></pre>
  <p>Its current output:</p>
  <pre><code>&quot;bat path:  VIVADO_BAT_PATH_2018_3&quot;
  &quot;bat path:  %env_var%&quot;
  </code></pre>
  <p>Desired Output:</p>
  <pre><code>&quot;bat path:  C:/Xilinx/Vivado/2018.3/bin/vivado.bat&quot; (or whatever value the env var is set to)
  </code></pre>
  <p>I know that I could get the desired output with <code>echo %VIVADO_BAT_PATH_2018_3%</code> but I am reading in <code>VIVADO_BAT_PATH_2018_3</code> as a variable, so how would I go about doing this?</p>