I want a vbs for opening Chrome and load a specific URL, but it doesn't work when the directory contains spaces.
My code, referred shell.run with variable, doesn't work. I'm just getting a error window saying
System cannot find the specific file. Error code : 80070002
Set Ws = CreateObject("WScript.Shell")
chromeLuncher = Ws.CurrentDirectory + "\Chrome\Application\chrome.exe --app=https://www.google.com --start-maximized"
Ws.Run DblQuote(chromeLuncher), 1, True
'****************************************
Function DblQuote(Str)
DblQuote = Chr(34) & Str & Chr(34)
End Function
'****************************************
How can I fix this?
Update 1:
The folder's structure:
Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 2018/6/4 10:42 Chrome -a---- 2018/6/4 15:23 190 fso.vbs
The Chrome's structure:
Chrome └─Application ├─61.0.3163.100 │ ├─default_apps │ ├─Extensions │ ├─Installer │ ├─Locales │ ├─swiftshader │ ├─VisualElements │ └─WidevineCdm ├─Dictionaries ├─plugins ├─SetupMetrics └─chrome.exe
Update 2:
I tried the code How to call Run() with parameters, changed my code to:
Set Ws = CreateObject("WScript.Shell")
chromeLuncher = """Ws.CurrentDirectory"" + ""\Chrome\Application\chrome.exe --app=https://www.google.com --start-maximized"""
Ws.Run chromeLuncher,1,True
Ws = Nothing
but still got the same error: