2
votes

I am new to vbscript and running procedures. I found some code that I'm trying to test so that I can get a feel for how vbscript works, and I am not sure why I am receiving an error message. I have created the below code in NotePad and then saved the file as a .vbs file on my desktop. Here is the code:

i=10

If i=10 Then

msgbox("This is my first script, Click OK to close")

Else

msgbox(“Hello world”)

End if

I thought that I would be able to open the file and get the message. Instead I am receiving the following error message:

Windows Script Host

Script: (my file location on my desktop) Line: 9 Char: 8 Error:

Invalid character Code: 800A0408 Source: Microsoft VBScript compilation error

2

2 Answers

2
votes

Replace

msgbox(“Hello world”)

with

msgbox("Hello world")

1
votes

It looks like line 9 character 8 is a “ and not a " character. That is probably the issue. You would also need to replace the ” character after world with a " character.