Wednesday, April 18, 2007

Debugging Windows Script Host VBScript

I just ran into this again today and I'm continually surprised by developers who don't know that you can debug VBScript using the Windows Script Debugger and more importantly Visual Studio 2003/2005 if its installed on the machine.

Next time you are writing a script and want to follow its execution throughout the entire lifecycle try typing the following at the command prompt:

cscript //X [scriptname].vbs

You will be prompted with a dialog asking what to do (depending on how the machine is configured for debugging and how many acceptable debuggers you have installed). Just follow the on-screen prompts.

Given that we automate a significant amount of tasks using VBScript, coupled with Windows Task Scheduler and Nant, being able to debug them is paramount to productivity.

No comments:

Post a Comment