title: Windows Batch File - ENABLEDELAYEDEXPANSION query
body: <p>Having read an existing post on <a href="https://stackoverflow.com/questions/305605/weird-scope-issue-in-bat-file">stackoverflow</a> and done some reading around on the net. I thought it was time to post my question before I lost too much hair!</p>
  
  <p>I have the following code within a batch file which I double click to run, under Windows XP SP3:</p>
  
  <pre><code>SETLOCAL ENABLEDELAYEDEXPANSION
  
  ::Observe variable is not defined
  SET test
  
  ::Define initial value
  SET test = "Two"
  
  ::Observe initial value is set
  SET test
  
  ::Verify if the contents of the variable matches our condition
  If "!test!" == "Two" GOTO TWO
  
  ::First Place holder
  :ONE
  
  ::Echo first response
  ECHO "One"
  
  ::Second Place holder
  :TWO
  
  ::Echo second response
  ECHO "Two"
  
  ::Await user input
  PAUSE
  
  ENDLOCAL
  </code></pre>
  
  <p>Basically I am trying to establish if I can navigate through my script using conditionals. It seems apparent that I am getting some issues with variable scope and delayed variable expansion yet I'm a little lost on what I'm doing wrong.</p>
  
  <p>Can anyone point me in the right direction?</p>