O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Windows Script Host 5.6

Windows Script Host (WSH) is designed to eliminate one of the major limitations of theWin32 platform: it has no real batch or macro language that allows common processes (such as creating shortcuts, writing to and reading from the registry, or getting information on the filesystem) to be automated. Windows’ predecessor, the character-based DOS operating system, for instance, included the DOS batch language. And Windows 3.0 included the idiosyncratic and unsuccessful Recorder, which allowed the user to “record” keystrokes and mouse clicks and later repeat them.

When you execute a WSH script, WSH uses WScript.exe as the runtime engine for scripts that run within the Windows environment and CScript.exe as the runtime engine for scripts that execute within a Command Prompt window. WSH is language-independent; it can be used with any language with a Windows Script-compatible script engine. The language most commonly used to write WSH scripts, however, is VBScript.

Why Use WSH?

WSH exposes a relatively small but very significant portion of the functionality of the 32-bit Windows family of operating systems. In addition, WSH allows you to tap into other object models (such as the FileSystemObject object model provided by the Scripting Runtime library) that allow you to access additional features of either the operating system or individual applications.

The advantage of any script is that it allows repetitive tasks—including complex ones that require multiple ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required