title: HTA as a Command Line GUI
body: <p>I'm in a bit of a bind...
  I'm trying to use HTA as a GUI to run some command line utilities in a more modern way...except it's not quite going as I'd hoped.</p>
  
  <p>So far I've tried a few tricks to get what I want done, but each one is falling a bit short of what I'm aiming for.</p>
  
  <p>My goal is to have my script run an exe that executes as a command line tool and capture the output in realtime, parse each line as it happens, and show something in the HTA window to indicate what the tool is doing behind the scenes, such as a progress bar or some kind of fancy formatted log output, rather than the console text of the cmd window.</p>
  
  <p>The trouble is, the only way I've seen to get HTA to run another program is either the .Run or .Exec functions of WScript.Shell.  Each has its own headache attached that keeps my GUI from doing its job.
  .Exec seemed to be what I wanted at first, since my intention is to capture the stdout from the command line and parse each line as it prints, but when I tried to use it, I noticed a big blank CMD window appearing and blocking most of the screen until the exe finished running.  Yes, the HTA captured the output and responded as I was hoping, but that blank CMD window kinda defeats the purpose of making a GUI.
  I tried .Run, but while that lets me run the exe in a hidden window, I can't capture the stdout in realtime and at best I can only dump it into a txt file and try to read it after the fact.</p>
  
  <p>Needless to say, neither is quite what I'm looking for...</p>
  
  <p>As a real world(ish) example of what I'd be looking to create, imagine running an HTA that runs ping with like 10 pings. I want to show a progress bar to show how many pings have completed, with some text showing an average total of each ping as they're happening, like how many pings were successful vs timed out, what the average ms per hit was, and so on.  Then when the ping tool finishes running, the HTA would remove the progress bar and show the final totals for the ping test.
  With .Exec, this technically works, but the entire time I have a command window sitting somewhere on the screen, which is annoying and usually blocks the HTA.
  With .Run, the HTA just appears to hang while the 10 pings run, and only gets the returned error code of 0, and then I have to load up a text file to see what happened before finally showing the results in the HTA...definitely not the ideal result.</p>
  
  <p>I feel like I'm missing something important... how can I get an HTA to run a command line executable in a hidden window while still being able to capture the output line by line in realtime? (I don't mind semi-realtime with JScript setTimeout or similar) I want to avoid having the command prompt window appearing at all, and I want to be able to show the output in the GUI as it's happening, rather than having to wait for it to complete and waste time writing a file, reading it, then deleting it.</p>