How to Run an HTA File from VBScript

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.

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.

Advertisement

Step 1

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

Video of the Day

Step 2

Copy and paste the following syntax into Notepad:

Advertisement

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

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

Advertisement

Advertisement

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.

Video of the Day

Advertisement

Advertisement

references