First of all, let me
say at the outset that if there is any way at all you can use Windows Powershell
instead of VBscript, do it. Powershell is the future of Windows
scripting.
But we all have to
go back and fix things from the past sometimes, and when we do it's nice to have
some tools.
One of the great
tools I use is Notepad++, a
free and highly configurable text editor for Windows.
You can configure
Notepad++ to open up a debugging program to step through the file you've
currently got open. First you have to edit your
%APPDATA%Notepad++shortcuts.xml file. In the <UserDefinedCommands>
element, add this line:
<Command name="Debug VBscript" Ctrl="no"
Alt="no" Shift="no" Key="0">wscript.exe //D //X
"$(FULL_CURRENT_PATH)"</Command>
This will add a command to the Notepad++ "Run" menu, that will execute the currently saved
version of your open file with wscript.exe, with the //D switch to tell it to
debug if it encounters any errors, and the //X switch to immeditely throw an
error at the beginning of execution.
Next, what debugger
should you use? Often you can get Microsoft Script Debugger to come up,
but if it all possible, see if you can use Microsoft Script Editor.
Microsoft Script Editor comes with Microsoft Office; I can find mine in
%PROGRAMFILES%Microsoft OfficeOFFICE11. It's called
MSE7.EXE.
It took a little
doing to figure out how to get it to come up as a debugger. I think this
registry edit should do the trick. Create a .reg file with these contents
and merge it with your registry [Disclaimer: DO ONLY AT YOUR OWN RISK!
Making a mistake modifying the registry can crash your
computer]:
REGEDIT4
[HKEY_LOCAL_MACHINESOFTWAREMicrosoftMachine Debug
ManagerJITDebuggingEngines{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}]
@="Script
Only"
[HKEY_LOCAL_MACHINESOFTWAREMicrosoftMachine Debug
ManagerJITDebuggingEngines{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}{000C1227-0000-0000-C000-000000000046}]
@=""
"Remote"=dword:00000001
For more help check here:
http://support.microsoft.com/kb/308364
3 comments:
Thank you for your time and interest in this post!
Comments to this blog are sometimes moderated to prevent spam. Please don't be alarmed if your comment does not appear immediately.