How to Run an HTA File from VBScript

By Lee Prangnell

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 1

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

Step 2

Copy and paste the following syntax into Notepad:Const SHOW_ACTIVE_APP = 1Set objShell = Wscript.CreateObject("Wscript.Shell")objShell.Run ("example.hta"), SHOW_ACTIVE_APP, TrueWscript.QuitChange "example.hta" to the actual HTA file name.

Step 3

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 4

Exit Notepad.