function readFromRegistry (strRegistryKey, strDefault)
Dim WSHShell, value
On Error Resume Next
Set WSHShell = CreateObject ("WScript.Shell")
value = WSHShell.RegRead (strRegistryKey)
if err.number <> 0 then
readFromRegistry= strDefault
else
readFromRegistry=value
end if
set WSHShell = nothing
end function
function OpenWithChrome(sPage)
Dim strChrome
Dim WShellChrome
strChrome = readFromRegistry ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe\Path", "")
if (strChrome = "") then
strChrome = "chrome.exe"
else
strChrome = strChrome & "\chrome.exe"
end if
Set WShellChrome = CreateObject("WScript.Shell")
strChrome = """" & strChrome & """" & " " & sPage
WShellChrome.Run strChrome, 1, false
end function
OpenWithChrome "auto slides.html"
在最后一行我调用函数OpenWithChrome,参数包含空格。但它无法在我的浏览器中打开该文件。
答案 0 :(得分:0)
您只需对空间进行编码,以便Chrome了解它。将该行更改为:
OpenWithChrome "auto%20slides.html"
有关编码使用空格的html文件的更多信息,请访问: