title: Windows command line: setting global variables to each other
body: <p><b>scenario further updated</b></p>
  
  <p>Hi all:</p>
  
  <p>I'm trying to set a global variable to another in windows command line batch language.  The syntax I've tried is as below:</p>
  
  <pre><code>:: these are global vars
  SET varThree=%varOne%\something
  SET varOne=
  SET varTwo=2
  
  :Section
  SET varOne=%varTwo%
  ::more setting of varOne to other global variables
  GOTO Section2
  
  :Section2
  echo %varThree%
  GOTO cleanup
  
  :cleanup
  SET varThree=
  SET varTwo=
  SET varOne=
  </code></pre>
  
  <p>The value of varOne seems to be lost when it comes to echoing %varThree%.</p>
  
  <p>I was wondering how can I set the above variable properly?</p>
  
  <p>TIA.</p>
  
  <p><em><strong>EDIT:</em></strong>
  The cleanup section was there as a way to ensure the variables are being cleaned up upon exiting of the program.  When I removed it, it took the 2nd run in order for varOne to lose its state.  Likewise when I re-introduced it, it took the 2nd run for the state of varOne to come back.  Any ideas why is this happening?</p>