title: Using Javascript in HTA file to read/write from Windows registry
body: <p>I'm currently attempting to write Javascript in order to read and write from the Windows registry in an HTA file. Here is the current code I am using to write:</p>
  
  <pre><code>writeInRegistry = function (sRegEntry, sRegValue) {
      Regpath = "HKEY_LOCAL_MACHINE\\Software\\CompanyName\\CompanyValues\\" + sRegEntry;
  
      try {
          var oWSS = new ActiveXObject("WScript.Shell");
  
          oWSS.RegWrite(Regpath, sRegValue, "REG_DWORD");
          oWSS = null;
  
  
      } catch (e) {
          alert('Error trying to write "' + sRegValue + '" to registry entry "' + sRegEntry + '"');
      }
  }
  </code></pre>
  
  <p>Unfortunately when I check the values in regedit, they remain unchanged. I made sure to double check that the registry path is exactly the same as I have it in javascript. It doesn't return an error, so I'm assuming the path is correct.</p>
  
  <p>I also attempted to try </p>
  
  <pre><code>var oWSS = WScript.CreateObject("WScript.Shell");
  </code></pre>
  
  <p>as referred to in this <a href="http://msdn.microsoft.com/en-us/library/x05fawxd" rel="nofollow">msdn</a> page, instead of</p>
  
  <pre><code>var oWSS = new ActiveXObject("WScript.Shell");
  </code></pre>
  
  <p>but that just gave me more problems.</p>
  
  <p>Any help is appreciated! Thanks!</p>