A script is simply a list of commands that are placed one after another and stored in a text file. Script commands are like building blocks: the more commands and programming techniques you learn, the broader your palette will be for making useful scripts. Some of the simpler building blocks will be used in this section of the chapter to illustrate the way scripts are built. Advanced users may prefer to skip to subsequent sections, which cover more advanced topics.
To run a script, just double-click on the script file icon; you'll probably never need to run the Scripting Host program (wscript.exe) directly.
There are actually two script interpreters (engines) included with Windows XP. WScript.exe is a native Windows interpreter and is used in most cases. CScript.exe is a console interpreter, which is used when you want the script output to be sent to the console (Command Prompt). You can use CScript.exe at any time by right-clicking a script file and selecting Open with Command Prompt.
When the Scripting Host runs the script, the commands are executed in order, one by one. You can leave Notepad open to make changes and additions while you test the script (big screens are especially handy for this sort of thing).
You can quickly open an existing script file for editing by right-clicking on it and selecting Edit. This will, by default, open Notepad, although you might want to associate the Edit action for .vbs files with a more powerful text editor (see ...