Krishna
Krishna

Reputation: 37

Getting compilation error , expected end of statement in vb script..

I have written a simple hello world program

<html>
<body>
<script type="text/vbscript">
document.write("Hello World")
</script>
</body>
</html>

saved as hello.vbs. I tried to run in cmd and by double clicking it. But I am getting the above compilation error

Upvotes: 0

Views: 981

Answers (1)

Ekkehard.Horner
Ekkehard.Horner

Reputation: 38745

A command line script can't contain neither HTML markup (<whatever>) nor reference components provided by the browser (document).

A hello word VBScript should look like

WScript.Echo "Hello world"

or

MsgBox "Hello world"

depending on whether you want to use a console (cscript hello.vbs) or wscript/double click on hello.vbs.

(cf. here)

Upvotes: 5

Related Questions