0
    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"

At last line i'm calling function OpenWithChrome with argument containing spaces. But it unable to open that file in my browser.

1 Answers1

0

You just need to encode your space so Chrome can understand it. Change that line to:

OpenWithChrome "auto%20slides.html"

More information on encoding html files that use spaces can be found here:

HTML: href syntax : is it okay to have space in file name

Community
  • 1
  • 1
freginold
  • 3,946
  • 3
  • 13
  • 28