--------------------------------------------------------------------------------
Unfortunately, sometimes I still have to work with VBScript. It actually isn't so bad for quickly whipping up a script that runs on a schedule to perform some sort of minor task. Sometimes it comes in handy to debug the script, and I'm making an entry on it for future reference. (A coworker showed me this)
1.) Make sure you set your VS settings as follows in Tools -> External Tools:
2.) Set your Internet Explorer settings accordingly:
3.) Load the script you wish to debug into Visual Studio... make sure it is VALID syntax or you'll never even hit the break point.
4.) Set your break points.
5.) Go to Tools -> VBSCript_Debugger to begin debugging.
NOTE: When you hit "stop", it will not actually stop script execution- only the debugging session- to actually stop the script from continuing, use the Immediate window to execute "wscript.quit".
You can also start the debugger on a server that does not have Visual Studio running by starting up a command prompt and firing up the VBScript debugger manually:
wscript.exe //d c:/test.vbs
You'll need to set a break point. (The command is "Stop" and you can add it anywhere in your script). This should automatically fire up the Microsoft Visual debugger if installed; if not you can download it from the Microsoft website.
As a final note, remember that often time errors in script are due to the account they are running under. This one's caused me to spin my wheels for linger that I wanted to until I realized my scheduled task was running under credentials preventing it from completing part of its job... it's always the simple things. :P
No comments:
Post a Comment