Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I open a file with VBScript?

Tags:

vbscript

How do I open a file with VBScript, as if the user had double clicked the file?

like image 618
lidia Avatar asked Aug 09 '10 08:08

lidia


People also ask

How do I open a VBScript file in Windows?

You can open and edit VBS files using any text editor, such as Notepad++ (Windows), Apple TextEdit (Mac), or GitHub Atom.


2 Answers

CreateObject("WScript.Shell").Run("C:\\Program Files\\my_html_files\\file.htm")
like image 150
abatishchev Avatar answered Sep 28 '22 04:09

abatishchev


CreateObject("WScript.Shell").Run("""C:\Program Files\my_html_files\file.htm""")

And check the application registered with the .htm extension (probably IExplore.exe), in these registry keys:

HKLM\SOFTWARE\Classes\.htm
HKLM\SOFTWARE\Classes\htmlfile\shell\open\command
HKCU\Software\Classes\.htm
like image 34
Michel de Ruiter Avatar answered Sep 28 '22 03:09

Michel de Ruiter