title: How do I use jQuery in Windows Script Host?
body: <p>I'm working on some code that needs to parse numerous files that contain fragments of HTML.  It seems that jQuery would be very useful for this, but when I try to load jQuery into something like WScript or CScript, it throws an error because of jQuery's many references to the window object.</p>
  
  <p>What practical way is there to use jQuery in code that runs without a browser?</p>
  
  <p><b>Update:</b> In response to the comments, I have successfully written JavaScript code to read the contents of files using <code>new ActiveXObject('Scripting.FileSystemObject');</code>.  I know that ActiveX is evil, but this is just an internal project to get some data out of some files that contain HTML fragments and into a proper database.</p>
  
  <p><b>Another Update:</b> My code so far looks about like this:</p>
  
  <pre><code>var fileIo, here;
  
  fileIo = new ActiveXObject('Scripting.FileSystemObject');
  here = unescape(fileIo.GetParentFolderName(WScript.ScriptFullName) + "\\");
  
  (function() {
      var files, thisFile, thisFileName, thisFileText;
  
      for (files = new Enumerator(fileIo.GetFolder(here).files); !files.atEnd(); files.moveNext()) {
          thisFileName = files.item().Name;
          thisFile = fileIo.OpenTextFile(here + thisFileName);
          thisFileText = thisFile.ReadAll();        
  
          // I want to do something like this:
          s = $(thisFileText).find('input#txtFoo').val();    
      }
  
  })();
  </code></pre>
  
  <p><b>Update:</b> I posted this question on the jQuery forums as well: <a href="http://forum.jquery.com/topic/how-to-use-jquery-without-a-browser#14737000003719577" rel="nofollow">http://forum.jquery.com/topic/how-to-use-jquery-without-a-browser#14737000003719577</a></p>