我們在使用VBS的時候,經常會遇到路徑中帶有空格的狀況,直接使用的話,腳本會報錯,那么我們如何處理呢,這里給大家總結了常用的3個方法,有需要的小伙伴可以參考下。
方法一:
|
1
2
3
|
Set
wshell=CreateObject("WScript.Shell")
wshell.Run """C:\Program Files\360\360se\360se.exe""",5,True
Set
wshell = Nothing
|
方法二:
|
1
2
3
4
5
6
|
temp="C:\Program Files\360\360se3\360se.exe"
path = Chr(34) & temp & Chr(34)
Set
wshell=CreateObject("WScript.Shell")
wshell.Run path,1,True
Set
wshell = Nothing
|
方法三:
|
1
2
3
4
5
6
|
Public
Const
vbQuote = """"
temp="C:\Program Files\360\360se3\360se.exe"
path = vbQuote & temp & vbQuote
Set
wshell=CreateObject("WScript.Shell")
wshell.Run path,1,True
Set
wshell = Nothing
|
|