[Previous] [Table of Contents] [Next]

Chapter 1

# Introduction to Windows Script Host

Versions of Microsoft Windows before Windows 98 provided almost no help for automating such tasks as backing up files and carrying out routine system administration tasks. Of course, you could use the old MS-DOS batch (BAT) files in the MS-DOS Prompt window to perform certain tasks, such as copying files. But BAT files can contain only a simple sequence of MS-DOS commands (only simple branches and no real looping functionality, among other drawbacks) and don't support dialog boxes and message boxes. In Windows 3.1, you could do a little more with the macro recorder to record and play simple keystrokes and mouse clicks, but the macro recorder didn't allow programming.

The search for a more powerful way to handle these automation tasks led users to seek out third-party solutions, such as PowerBatch or programming environments such as Delphi, Microsoft Visual Basic, and Microsoft Visual C++. But many Windows users found these solutions unacceptable because they were neither simple nor free.

Because Microsoft Office provides Visual Basic for Applications (VBA) and because Web authors know scripting languages such as Microsoft Visual Basic, Scripting Edition (VBScript), and Netscape's JavaScript, it was only a matter of time before Microsoft provided a scripting tool for Windows operating systems. This tool is Microsoft Windows Script Host (WSH), which falls under the umbrella of Microsoft's Windows Script technologies.

WSH is a stand-alone host that enables you to execute a script file directly at the operating system level. For example, you can invoke a script from a command-line interface or you can double-click a script file in Windows Explorer. WSH is handy for many administrative tasks that require little or no user interface. It is far more versatile than old MS-DOS batch files because JScript and VBScript are powerful scripting languages that have full access to WSH objects and any other available Automation objects.

> NOTE

> Before version 2, Windows Script Host was known as Windows Scripting Host. In this book, I'll refer to both versions as WSH.