Favorite Links Writing Your First Script Debugging Your Scripts Code Samples
Getting Scripting This is the page you start at to get scripting if you don't have it. Sure, if you have Windows98/NTSP4 or newer, you already have it on your CDROM or hard drive. But getting it from here means you get the latest version. It's worth the download if you have even a slim doubt. Getting the scripting host and VBScript/JScript engines is easy (they're bundled), but you'll have to crawl through the links to find the help files and the sample code collection. And of course, to encourage you to upgrade, Windows 95 is no longer supported in the most recent versions. You'll need to get version 5.5 if you have Win95. No guarantee that's even going to work since 95 isn't supported any longer!
Essentials of VB Scripting After you install it, it becomes a collection of web pages (IE required) that cover how to use version 3 scripting (the early version without all the cool features) in all three ways: Server ASP, Client Web Pages, and the Windows Scripting Host. This is about a 30-minute overview of how to do the basics. If you've never done scripting, this is a good starting place.
Learn to Script Microsoft's list of suggested resources for people wanting to learn scripting.
Windows 2000 Scripting Guide If you don't buy the book, read it online.
Scripting Tools WMI Browser Script Debugger ScriptCenter Microsoft's essential tools to help you write sample scripts or see what you are doing.
Ian Morrish Not just any scripting, he's exclusively a Windows Scripting Host kind of guy!
Guenter Born A grab bag of scripting fixes and tips. And my favorite: How to use Microsoft VB5CCE to write your own controls.
Alex Angelopoulos Alex has a handy "Scripting Mini-FAQ" and a selection of scripts that tend to be a bit more advanced than mine.
News:Vbscript If you have a question, it's already been asked and answered here.
News:Wsh Ummm... Or here.
It seems that there is no "native" editor for the Windows Scriping Host. You can borrow the VBA or VBS editor in a Microsoft Office product or use a .NET editor in Visual Studio or even use the web page editor in something else. Things like that work pretty good, but very little really understands WSH (Windows Scripting Host). So knowing of an editor that can be configured to support at least some part of scripting is handy. I offer these suggestions.
$179 -- It costs more, but it's worth it. I bought it and use it every
day. Designed from the ground up to support the Windows Scripting Host
syntax highlighting, parameter help, intellisense for VBScript and
JScript, built-in object browser, support for WSC and WSH files, and
Type "Wscript", hit a period, and up pops a list of all methods and
Type "MsgBox", hit a space key, and see the correct usage with all
right above where you are typing. The coolest thing is that it even
intellisense for objects with late binding (you know, "CreateObject").
Even VB doesn't do that! Don't take my word, download the demo and see
for yourself. You'll be stunned. Also supports Perl, Java, Tcl, Rexx,
Html, SQL, Batch, Awk, C, C++, Kixtart, and Pascal.
Visual Studio FREE -- Why would anybody
use a pirated
copy of VS when Microsoft gives away perfectly good beta versions for
free? VS doesn't understand the Windows Scripting Host, but it supports
all other objects and the VBS language with late binding intellisense,
code completion, and parameter help. And it has a great integrated
debugger (don't use the generic scripting debugger if you have the VS
Office VBA /
MSE -- If you have any of the Microsoft
applications, you've got a usable script editor. Sort of.
VBA (the Visual Basic for Apllications editor) or MSE (the Microsoft
Script Editor) is perfect, but both have a good object browser. VBA is
very similar to VBS, and VBA can fake WSH if you add the appropriate references. MSE understands
VBS, but both
VBA and MSE require too much effort for daily use.
Separate versions for VBS and JS files. Has intellisense, parameter
help, auto-capitalization. Does not support any other languages
FREE -- Supports almost every language. Extendable, configurable, and
programmable so you can use it to build your own editor.
color-coding of keywords, but integrates with most command-line
build/run tools (like cscript) so it acts like a debugger too! See
example customization and extensions for VBS/WSF here.
EditPlus $30 -- Syntax highlighting and code completion. Extendable to any language.
ScriptBuilder $139 -- Primarily a script editor for web pages. Syntax highlighting, online language reference.
CodeMax FREE -- Syntax highlighting. Supports VB, C/C++, Java, SQL, Pascal, and Basic. Includes an ActiveX object you can use to build your own code editor.
Vim FREE -- Syntax highlighting. Supports virtually all languages or any conceivable text formatting scheme. Extendable to additional keywords or languages. The UNIX origins are very apparent -- everything happens in a bland terminal window. Not all versions are stable under Windows.
Try another simple one: Again start up Notepad, but enter this
strMyName = InputBox ("Enter your name")
MsgBox strMyName & " is my master!"
Again, save it (any name with a .vbs extension) and double-click it. Easy.
From here, you just need to read the help files (After you FIND the help files on Microsoft's site!) on Visual Basic Scripting and the Windows Scripting Host to see what other things you can do. Also check out the sample code Microsoft provides! Search your C: drive for all "*.vbs" files if you're not sure where they are. By far the coolest thing about scripting is how it can control Excel, Word, or most any other ActiveX program. Once I saw the "chart.vbs" sample Microsoft provided, I was hooked!
First, when your script fails, the Windows Scripting Host will tell you the line number, column number, and a description of the error. The error it reports gives you a good starting point, but trying to count down to line 132, column 43 to find it in your code is unworkable. Because... The default script editor (if you right-click a VBS file and select "Edit") is Notepad. And Notepad has no line or column counters. So you can buy a nice script editor like I did. Or use a fancy word processor or the old DOS program EDIT.COM.
the handiest free item
has is the scripting
debugger. The debugger works three ways:
First, you can use it to open and edit your scripts. It's about as useful as Notepad in this respect. Pretty lame.
Second, when you have an error, the debugger opens up and highlights the line where the error occurred. Well, if you have the original scripting Host that shipped with Win98 or NTSP6 it acts that way. If you upgraded your scripting host to the most recent version, the debugger won't start on an error unless you launched your script with the "//d" option (like "wscript //d myscript.vbs" or "start myscript.vbs //d". It won't let you do anything about the error in this mode other than running a command in the "Command Window". Getting better...
Third, you can put the word "stop" in your script. When your script hits that "stop" line, it pauses and starts up the debugger. Again, that's only true on the original version of the scripting host. On the new version, you have to use the //d option to get it to recognize the "stop" word. In this mode, you can step through your code and use the full capabilities of the debugger.
Fourth, you can start your script with the //x option (if you have the new version of the scripting host). That way it starts the script in the debugger automatically without waiting for an error or a stop word.
So basically, unless you use "stop", "//d", or "//x", the debugger will do nothing more than frustrate you. I use the //x option so much I set up a right-click association for VBS files.
CAUTION: Don't install the scripting debugger if you have Microsoft Visual Studio (VS) or VS .NET on your system. You don't need it! VS has a built-in debugger that works just fine (actually better!) on scripts. Installing multiple debuggers could tear a hole in the universe. Or in your computer. However, I've found that having VS6 and VS.NET on the same computer is no problem. You just get asked which debugger you want to use.
Lost? Look at the site map.
Bad links? Questions? Send me mail.