WshShell Object

Microsoft® Windows® 2000 Scripting Guide

microsoft windows 2000 scripting guide

« Previous | Next »   

The shell is the component of Windows that presents users with an interface to the operating system and provides familiar elements of the Windows desktop experience, including Windows Explorer, the Start menu, shortcuts, and desktop themes.

The WshShell object gives your scripts the ability to work with the Windows shell. Your scripts can use the WshShell object to perform a number of system administration tasks, including running programs, reading from and writing to the registry, and creating shortcuts.

Figure 3.10 shows the properties and methods of the WshShell object.

Figure 3.10   WshShell Object Model

WshShell Object Model

Accessing the WshShell Object

The WshShell object is a COM object, and using the following code statement can create an instance of the object:

Set objShell = WScript.CreateObject("WScript.Shell") 

WshShell Capabilities

The WshShell object enables your script to automate tasks in a number of categories related to the Windows shell. Table 3.8 lists these categories along with the methods and properties of the WshShell object that your scripts can use to access this functionality.

Table 3.8   Capabilities Provided by the WshShell Object

CategoryMethod or Property
Running ProgramsRun, Exec
Working with Special FoldersSpecialFolders
Working with ShortcutsCreateShortcut
Working with Environment VariablesEnvironment, ExpandEnvironmentStrings
Working with the Event LogLogEvent
Working with the RegistryRegRead, RegWrite, RegDelete
Sending Keystrokes to an ApplicationAppActivate, SendKeys
Obtaining a Script s Current DirectoryCurrentDirectory
Creating Timed Dialog BoxesPopup

send us your feedback Send us your feedback « Previous | Next »   


Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 635

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net