VBScript in Visual Studio

Tue, Mar 9, 2010

Misc. Code, Technology

Over the years I have observed how Microsoft’s Visual Studio product kept reducing support for VBScript.  Really strange since VBScript is still one of the best ways to manage your Windows environment. 

Not a huge deal though, as there are hundreds of text editing tools out there like NotePad++, E – TextEditor, NotePad2, and VbsEdit.   Heck there’s even those really expensive IDE solutions dedicated to scripting (yes, including VBScript) like PrimalScript.

But even with all of those choices I have always returned to using Visual Studio for editing and debugging scripts.  The one complaint I have had the hardest time accepting was the inability to launch a VBScript from within the IDE, and optionally launch it with the debug setting enabled.

Turns out that feature has been there all along, I just never knew how to configure it properly.  So how about I share my recently gained knowledge with you?

My first task was to make it possible to launch my scripts from the IDE.  To accomplish this I simply had to add some settings to the External Tools feature.  You can find this by clicking on the Tools dropdown and clicking on External Tools:

vscapture1 Next I added a new External Tool entry by clicking on Add and then entered in the necessary information for CScript and WScript (never know when you may need either one):

vscapture2Now when I select the Tools menu I can see the option to select CScript or WScript and it will run with the current script that I am working with.  But wait, it gets better…

Suppose you don’t want to always have to click on the Tools | CScript?  Its possible to create a custom toolbar with links to the external tools you have configured.  Simply click View | Toolbars | Customize…

On the top of the dialog you can select Toolbars and then New to create your own toolbar.  Once you have the toolbar created you can select the Commands, find the category Tools, and then locate the External Tools Commands.  By dragging the External Command 1 to the newly created toolbar the first entry in your External Tools list will be available now for you to click whenever need it…

So in the end I can now launch CScript/WScript with or without debug enabled by simply clicking on my custom toolbar…

If you don’t feel up to going through the steps I outlined but still want to use the features you can simply download my backup file that only contains the External Commands list and the custom Toolbar.  Just download the file, open Visual Studio, select Tools | Import and Export Settings, and locate the recently downloaded backup file.  When you’re finished with the import you will have all of the goodies described in this post.

  VisualStudio_Scripting-Add-on.zip (1.8 KiB, 285 hits)

,

One Response to “VBScript in Visual Studio”

  1. Roshan Says:

    Thank you that was very helpful. I have been using Visual Studio for a long time for VBScript, the external tools was really useful.


Private