1

I am currently trying to call a .vbs file from a batch file and it keeps giving me an error.

This is my batch file:

@ECHO ON
cscript "C:\Users\Alex.Newton\Desktop\VBScripts\First scripts\This is my first script.vbs"
PAUSE

This is my VB Script:

<SCRIPT LANGUAGE="VBSCript">
MsgBox "Welcome"
</SCRIPT>

Saved as .vbs.

I get the error:

C:\Users\Alex.Newton\Desktop\VBScripts\First scripts\FirstScriptWow.vbs(1, 1) Microsoft VBScript compilation error: Expected statement
0

2 Answers 2

3

Delete the <script> tags. They are not required in a .VBS file.

0

You need tags to embed script into HTML page, but you run script with Windows Script Host, not with InternetExplorer, so remove tags.

By the way, it is better to use WScript.Echo because it prints to console in cscript mode and does msgbox in wscript mode.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .