Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking VBScript syntax

Any good utilities out there for verifying VBScript syntax without actually running the script?

What I'm getting at is if I do something like:

If (year == "2005" && type == 1) Then
...
End If

Is there a tool that will tell me that the '&&' really should be 'And' and the '==', just '='?

like image 341
Scott Marlowe Avatar asked Aug 18 '09 19:08

Scott Marlowe


1 Answers

If you don't want to run your script because you don't want it to actually do anything, then one method I've used is to put in a "WScript.Quit" statement at the beginning of the script (after the Option Explicit if there is one) then run it using cscript.exe or wscript.exe.

For example:

Option Explicit
WScript.Quit
Dim year
If (year == "2005" && type == 1) Then
    WScript.Echo "Hello"
End If

This won't capture undefined variables (like "type" above), but it's an easy, quick way to check you've got the right syntax.

like image 155
intDattashame Avatar answered Nov 02 '22 15:11

intDattashame