title: Can someone please give an explanation to these different outputs
body: <p>Please see the 2 sample codes:</p>
  
  <pre><code>@ECHO off
  
  Set RegQry=HKLM\Hardware\Description\System\CentralProcessor\0
  
  REG.exe Query %RegQry% &gt; checkOS.txt
  
  Find /i "x86" &lt; CheckOS.txt &gt; StringCheck.txt
  
  
  If %ERRORLEVEL% == 0 (
       Echo "This is 32 Bit Operating system"
     set ProgFileDir=%ProgramFiles%
  ) ELSE (
  
       Echo "This is 64 Bit Operating System"
        set ProgFileDir=%ProgramFiles(x86)%
  )
  del checkos.txt
  del stringcheck.txt
  
  echo ---------------
  echo "%ProgFileDir%"
  echo ----------------
  pause
  </code></pre>
  
  <p>This is giving me a wrong output:</p>
  
  <pre><code>"This is 64 Bit Operating System"
  ---------------
  "C:\Program Files (x86"  &lt;==Notice how the closing brace is trimmed
  ----------------
  Press any key to continue . . .
  </code></pre>
  
  <p>If i change the position of the statement <code>set ProgFileDir=%ProgramFiles(x86)%</code> outside the bracket:</p>
  
  <pre><code>@ECHO off
  
  Set RegQry=HKLM\Hardware\Description\System\CentralProcessor\0
  
  REG.exe Query %RegQry% &gt; checkOS.txt
  
  Find /i "x86" &lt; CheckOS.txt &gt; StringCheck.txt
  
  
  If %ERRORLEVEL% == 0 (
       Echo "This is 32 Bit Operating system"
     set ProgFileDir=%ProgramFiles%
  ) ELSE (
  
       Echo "This is 64 Bit Operating System"
  )
  del checkos.txt
  del stringcheck.txt
  
        set ProgFileDir=%ProgramFiles(x86)%
  echo ---------------
  echo "%ProgFileDir%"
  echo ----------------
  pause
  </code></pre>
  
  <p>I get the correct result:</p>
  
  <pre><code>"This is 64 Bit Operating System"
  ---------------
  "C:\Program Files (x86)" &lt;== with the closing brace
  ----------------
  Press any key to continue . . .
  </code></pre>
  
  <p>What am i doing wrong here? I am running this batch file on Windows 7 64 bit OS.</p>