Chapter 9. Scripting and Automation
Scripting, a simple form of programming, is well suited to such quick-and-dirty tasks as automating repetitive procedures, simplifying file operations, and even creating small Common Gateway Interface (CGI) server-side scripts for web servers.[146] Scripts are usually plain-text files that can be written and executed without a special development environment and don’t require a compiler, a program that turns certain kinds of code into executables.[147]
Windows comes with two forms of scripting: the Windows Script Host (WSH) and DOS batch files. Both technologies have their strengths and limitations. DOS batch files are somewhat simpler to write, but WSH scripts are more flexible and offer better user interaction. WSH scripts are Windows-based, have full support of long filenames, and can even communicate with other running Windows programs. DOS batch files run on any PC made after 1982, but WSH scripts run only on Windows 98, Windows Me, and Windows 2000 (earlier versions of these operating systems only with a free add-on). Additionally, you can use both technologies in conjunction to accommodate just about any task you throw at them; see Section 9.8 later in this chapter for an example. DOS batch files are fully documented in Appendix B.
The main roadblock to using the Windows Script Host has been the lack of adequate documentation on writing scripts for use in Windows. For example, Scheduled Tasks earn only a few sentences in the Windows ...
Get Windows Me Annoyances 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.