Debug VBScript / VBS files in Visual Studio 2010

I needed to be able to step through a VBScript file that was being run in an environment that I did not have on my machine and this environment did not have a debug environment that I could use to step through the VBScript being executed.  The VBScript was simply looking to see if a folder exists on a network drive and if the folder did exist, create the folder.   Then the script would copy some files to the network drive / folder location.  My machine and user id had access to this network drive so I could run this VBScript from my machine.
So placed the VBScript file (script.vbs) on my computer at C:\Projects\VBS\.
Then I ran the Visual Studio 2010 Command Prompt as Admin and changed the directory to the above location:

I then typed in the following and selected the enter key to run the Visual Studio Just-In-Time Debugger: cscript /x /d script.vbs

The following will be presented:

Be sure you select the "New instance of Microsoft Visual Studio 2010" and select the "Yes" button.  Once yes is selected, Visual Studio will open with the script file opened and paused at the first line in the script.  Now you can step through the script begin debugging.

Comments

Popular posts from this blog

A good use of Common Table Expressions

Setting Up Visual Studio Environment for Selenium