title: Batch File: If registry key's data is equal to
body: <p>I'm trying to make a .bat toggler for certain Explorer settings. To do this I need the batch file to query the Registry key's data and then set the key accordingly. For example, in ActionScript 3 or JavaScript it would be something along the lines of this:</p>
  
  <pre><code>if (HideFileExt == "00000000"){
      HideFileExt = 00000001;
  else {
      HideFileExt = 00000000;
  }
  </code></pre>
  
  <p>This way, every time it runs it will set the key's data to be the opposite of what it currently is - a toggler.</p>
  
  <p>I have Google-d this extensively and after quite a long time of chopping up and splicing multiple examples, I eventually got this:</p>
  
  <pre><code>REG QUERY HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v HideFileExt /t REG_DWORD /d 00000000
  
  if errorlevel 1 (
      echo Num 1
  ) else (
      echo Num 2
  )
  
  rem The "echo Num"s are there just so that I could eventually figure out what the errorlevel does
  </code></pre>
  
  <p>which returns the error:</p>
  
  <pre><code>ERROR: Invalid syntax.
  Type "REG QUERY /? for usage.
  num 1
  </code></pre>
  
  <p>If I remove the <code>/d 00000000</code> from the <code>REG QUERY</code> then it returns the accurate data value of the key without error. I have also tried it with <code>/d 0</code>, <code>/d 0x0</code> and <code>/d 0x00000000</code> and they didn't work either.</p>