How do I open a file with VBScript?

2020-08-16 08:17发布

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

标签: vbscript
3条回答
2楼-- · 2020-08-16 08:19
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
查看更多
霸刀☆藐视天下
3楼-- · 2020-08-16 08:22

http://msdn.microsoft.com/en-us/library/bb774148(VS.85).aspx

<script language="VBScript">
function fnShellExecuteVB()
    dim objShell

    set objShell = CreateObject("Shell.Application")

    objShell.ShellExecute "notepad.exe", "", "", "open", 1

    set objShell = nothing
end function
</script>
查看更多
叼着烟拽天下
4楼-- · 2020-08-16 08:36
CreateObject("WScript.Shell").Run("C:\\Program Files\\my_html_files\\file.htm")
查看更多
登录 后发表回答