Saturday, August 1, 2015

Checking VBScript for syntax errors without actually running the script




I have a script in VBScript. I'm not sure if it contains any syntax errors or other non-runtime errors. Normally I would just run the script, but I don't want the script to actually run because the changes it makes are hard to reverse correctly.



Is it possible to make W/CScript check for syntax errors but not run the script if none were found?



I didn't know if this was better suited for SO but I thought it was more WScript specific, as my question lies with WSCript and not the script itself.


Answer



For those that like to know how I worked around this:



The majority of the script were subs and functions, with only a few lines of code that were executed on startup. I moved those lines into a Sub Main, and places a line to call Main on the first line.




If I needed to check for syntax errors, I could comment the line that calls Sub Main so no code would be executed.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...