How to use Vbscript in HTA.

Batch, ASP, JScript, Kixtart, etc.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
Posts: 14
Joined: Sat Oct 16, 2010 3:02 am

How to use Vbscript in HTA.

Post by » Thu Jan 05, 2012 12:52 pm

How can I use the below script in HTA . "wscript.sleep" is not allowed in HTA so what should I use instead of wscript.sleep ?

This script calls a exe file by making use of Runas command . If I am running this script directly it is working fine only in HTA it is not working .

set WshShell = WScript.CreateObject("WScript.Shell") PARAM1="DOMAINabhishek.shukla"PARAM2="pASSWORD" "runas /user:"&PARAM1&" %comspec%" 'Open command prompt WScript.Sleep 1000 WshShell.SendKeys PARAM2 'send password WshShell.SendKeys "{ENTER}" WScript.Sleep 1000 WshShell.SendKeys Chr(34) + "C:TempFallbacktool.EXE" + Chr(34) WshShell.SendKeys "{ENTER}" WshShell.SendKeys "exit" 'Close command prompt WshShell.SendKeys "{ENTER}" WScript.Sleep 1000