1

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 ""path"",3,True
Set Sh = Nothing 

However on executing this I am getting following error


Windows Script Host

Script: F:\Sperry\2010\May_06 May\open.vbs Line: 4 Char: 10 Error: Expected end of statement Code: 800A0401 Source: Microsoft VBScript compilation error


OK

Can anyone help me in this?

1 Answer 1

3

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.