How to Run an HTA File from VBScript

Visual Basic Scripting Edition, commonly referred to as VBScript, is an active scripting programming language based on Component Object Model (COM), which was developed by Microsoft in 1996. HTA is a HTML-executable application that runs in the same manner as a typical "exe" file. HTA files do not require a Web browser, such as Microsoft Internet Explorer, Mozilla Firefox or Google Chrome, to execute a Web page. You can use the "Run Method" to run an HTA file using VBScript.

Step

Click "Start," "All Programs" and "Accessories." Click on the "Notepad" shortcut icon, which will open Windows Notepad.

Step

Copy and paste the following syntax into Notepad:

Step

Const SHOW_ACTIVE_APP = 1 Set objShell = Wscript.CreateObject("Wscript.Shell") objShell.Run ("example.hta"), SHOW_ACTIVE_APP, True Wscript.Quit

Step

Change "example.hta" to the actual HTA file name.

Step

Press "Ctrl" and "S" on your keyboard; a file save dialog box should appear. Change the file type to "All Files," type the file name "hta.vbs," change the file save location to the Windows desktop, and then click "Save." This will save the file as a VBScript file to the Windows desktop.

Step

Exit Notepad.