title: wscript.sleep happening at wrong time
body: <p>I don't know VBScript, but recently I needed to write a script that had the SendKeys functionality, and I couldn't do that in a batch file. When I run the following code from command prompt in my Windows 7 machine using the command <code>cscript test.vbs</code>, the sleep happened before telnet was started. The issue might be that the command is executed but the resulting output isn't displayed until after the sleep is finished. How would I fix this?</p>
  
  <pre><code>Set WshShell = WScript.CreateObject("WScript.Shell")
  WshShell.SendKeys "telnet localhost 25" &amp; vbCr
  wscript.sleep 5000
  </code></pre>
  
  <p>EDIT: I can get my script to work if I put a sleep command before it starts and then click on the command prompt window it has to type into. This way, when the script pauses, it pauses execution but doesn't pause the output in command prompt from being displayed. I still need a command line solution. </p>