One of the general disadvantages of scripts is that they are typically created with a plain-text editor, rather than a rich debugging environment used with many more sophisticated programming languages (see Section 9.12 later in this chapter). Because Notepad isn’t specifically designed to understand VBScript, it can’t offer any assistance with syntax (grammar) or errors while you’re editing. Therefore, you must wait until you run the script to see if there are any problems. If WSH encounters an error, it will display a message similar to that shown in Figure 9-2.
Figure 9-2. The Windows Script Host will display a message like this whenever it encounters an error
This sparse message box actually provides enough information to resolve most problems. Naturally, the first field, Script, shows the script filename in which the error occurred. This is especially useful if the script was run from a scheduled task or from your StartUp group, and you might otherwise not know which script caused the error.
The Line Number and Column fields show exactly where in the script the error occurred. Unfortunately, Notepad doesn’t tell you what line the cursor is on, so you’ll either have to count down from the top and then over or use a better text editor (see later in this chapter).
Category describes—more than anything else—what it was doing when it encountered the error. ...