title: variable in variable in batch and delayed expansion
body: <p>I'm trying to use variable in variable in conjunction with delayed expansion but still no luck.</p>
  
  <pre><code>SETLOCAL EnableDelayedExpansion
  SET ERROR_COMMAND=exit /B ^!ERRORLEVEL^!
  </code></pre>
  
  <p>This is my last try. I want to setup an ERROR_COMMAND to be called when one of the steps in batch file crashes. The command is supposed to be:</p>
  
  <pre><code>IF ERRORLEVEL 1 !ERROR_COMMAND!
  </code></pre>
  
  <p>or</p>
  
  <pre><code>IF ERRORLEVEL 1 %ERROR_COMMAND%
  </code></pre>
  
  <p>The thing is, I'm not able to find out, how to SET properly the ERROR_COMMAND variable, so that ERRORLEVEL is not evaluated at the time of assignment, but at the time of evaluating the variable</p>
  
  <p>Of course I can copy&amp;paste the code all over the batch file, but using the variable just seems a bit prettier...</p>
  
  <p>Anyone?</p>
  
  <p>Thanks, Milan</p>