Chapter 17. Creating Standalone Scripts with Windows Script Host

IN THIS CHAPTER

  • Writing Windows Script Host scripts

  • Using the Microsoft Script Editor and the VBS Help file

  • Differences between VBS and VBA code

  • Scripts for working with Office documents

  • Scripts for working with files

  • Using the Windows Vista Task Scheduler to run a backup script

For many versions now, Windows has had its own scripting language, Windows Script Host, a dialect of Visual Basic Script (VBS). Windows Script Host (WSH) scripts can be run from the command line (for those versions of Windows that have a command line, click Start

Creating Standalone Scripts with Windows Script Host

One use for a WSH script is to create a database backup at regular intervals; another is to copy Word or Excel templates, or other supporting files, to the appropriate folder, as part of an Office application setup, when you don't want (or need) to create a full Install package. WSH scripts are also useful for working with files in a folder, doing tasks such as deleting or renaming files containing a certain prefix, suffix, or extension. This chapter describes how to create and modify WSH scripts, including sample scripts for some common uses.

Tools for Working with Windows Script Host Scripts

Though you can create and edit WSH scripts with Notepad, it is a lot easier to work with them in the Microsoft Script Editor (MSE), using the VBScript downloadable Help file for reference. Curiously, neither ...

Get Access™ 2007 VBA Bible: For Data-Centric Microsoft® Office Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.