Some Sample Scripts

We don’t have room here to give you even an introductory course in VBScript programming. As mentioned, that’s a topic that can fill an entire book. What we can do is give you some examples of how WSH can be used to perform useful tasks and to manage Windows. These sample scripts assume that you have set the default script environment to console mode, as opposed to windowed mode, by typing this command just once in an elevated Command Prompt window:

cscript //h:cscript //nologo //s

(Elevated Command Prompt windows were described earlier in this chapter.)

Disk and Network Management

WSH comes with tools to examine and modify drives, folders, and files. Here is an example of a VBScript script that performs a reasonably useful ...

Get Windows 8 In Depth 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.