如何使用VBScript打开文件?

问题描述 投票:8回答:3

如何使用VBScript打开文件,就像用户双击该文件一样?

vbscript
3个回答
9
投票
CreateObject("WScript.Shell").Run("""C:\Program Files\my_html_files\file.htm""")

并在这些注册表项中检查使用.htm扩展名(可能是IExplore.exe)注册的应用程序:

HKLM\SOFTWARE\Classes\.htm
HKLM\SOFTWARE\Classes\htmlfile\shell\open\command
HKCU\Software\Classes\.htm

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

1
投票

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>
© www.soinside.com 2019 - 2024. All rights reserved.