VBScript and filename with space

后端 未结 1 483
滥情空心
滥情空心 2021-01-25 14:53

I wrote a VBS file to open the \"6 May\" folder with following content

path = \"F:\\Test\\2010\\May\\6 May\"
Set Sh = CreateObject(\"WSCript.Shell\")
Sh.Run \"\"         


        
相关标签:
1条回答
  • 2021-01-25 15:49

    Your ""path"" syntax is incorrect. To concatenate strings in VBScript, you need to use the & operator. Also, to specify a quote character as part of the string, you need to double it. So, your script should look like this:

    path = "F:\Test\2010\May\6 May"
    Set Sh = CreateObject("WSCript.Shell")
    Sh.Run """" & path & """", 3, True
    Set Sh = Nothing
    
    0 讨论(0)
提交回复
热议问题