Appendix G The Windows Script Host Object Model

Overview

This Appendix gives details about the Windows Script Host objects. Further details and examples can also be found in Chapter 12.

Windows Script Host has 14 objects outlined.

This object provides access to most of the objects, methods , and properties contained in the WSH object model.

This object gives the programmer access to the entire collection of command-line parameters in the order in which they were originally entered.

This object exposes the method CreateScript() that creates a remote script process.

This object gives the programmer access to the collection of Microsoft Windows system environment variables .

This object provides access to the named command-line script arguments contained within the WshArguments object.

This object gives the programmer access to the shared resources on the network to which the host computer is connected.

This object provides access to the remote script process.

This object is used to expose the error information available when a remote script terminatesas a result of a script error.

This object provides status and error information about a script.

This object is used to give the programmer access to the native Windows shell functionality.

This object allows the programmer to create shortcuts.

This object is used to access Windows Special Folders.

This object provides access to unnamed command-line script arguments within the WshArguments object.

This allows the programmer to create a shortcut to an Internet resource.

The WScript Object

The root of the WSH object model is the WScript object. This object provides properties and methods that give the developer access to a variety of information, such as:

WScript Properties

The WScript object has 11 properties:

WScript Methods

The WScript object has seven methods:

The WshArguments Object

This object gives the programmer access to the entire collection of command-line parameters.

WshArguments Properties

The WshArguments object has four properties:

WshArguments Methods

The WshArguments object has two methods:

WshController Object

This object is used to expose the method CreateScript() that creates a remote script process.

WshController Properties

The WshController object has no properties.

WshController Methods

The WshController object has one method:

WshEnvironment Object

This object provides access to the collection of Windows environment variables .

WshEnvironment Properties

The WshEnvironment object has two properties.

WshEnvironment Methods

The WshEnvironment object has two methods:

WshNamed Object

This object is used to provide access to named arguments from the command line.

WshNamed Properties

The WshNamed object has two properties:

WshNamed Methods

The WshNamed object has two methods:

The WshNetwork Object

The WshNetwork object provides access to the shared resources on the network to which the computer is connected.

WshNetwork Properties

The WshNetwork object has three properties:

WshNetwork Methods

The WshNetwork object has eight methods:

WshRemote Object

This object is used to provide access to the remote script process.

WshRemote Properties

The WshRemote object has two properties:

WshRemote Methods

The WshRemote object has two methods:

WshRemoteError Object

This object provides access to the error information available when a remote script terminates because of a script error.

WshRemoteError Properties

The WshRemoteError object has six properties:

WshRemoteError Methods

The WshRemoteError object has one method:

WshScriptExec Object

The WshScriptExec object provides status information about a script run with Exec when used in conjunction with the StdIn , StdOut , and StdErr streams.

WshScriptExec Properties

The WshScriptExec object has four properties:

WshScriptExec Methods

The WshScriptExec object has one method:

The WshShell Object

Windows Script Host provides a convenient way to gain access to system environment variables , create shortcuts, access Windows special folders such as the Windows Desktop, and add or remove entries from the registry. It is also possible to create more customized dialogs for user interaction by using features of the Shell object.

WshShell Properties

The WshShell object has three properties:

WshShell Methods

The WshShortcut Object

The WshShortcut object allows you to create shortcuts using script.

WshShortcut Properties

The WshShortcut object has eight properties:

WshShortcut Methods

The WshShortcut object has one method:

The WshSpecialFolders Object

The WshSpecialFolders object provides access to the collection of Windows special folders. The following special folders are available:

WshSpecialFolders Properties

The WshSpecialFolders object has one property:

WshSpecialFolders Methods

The WshSpecialFolders object has one method:

The WshUnnamed Object

The WshUnnamed object provides access to the unnamed arguments from the command line. The WshUnnamed object is a read-only collection that is returned by the Unnamed property of the WshArguments object. All individual argument values are retrieved from this collection using zero-based indexes.

There are three ways to access sets of command-line arguments:

WshUnnamed Properties

The WshUnnamed object has two properties:

WshUnnamed Methods

The WshUnnamed object has one method:

The WshUrlShortcut Object

The WshUrlShortcut object allows you to create shortcuts to Internet resource using script. The WshUrlShortcut object is a child object of the WshShell object. You must use the WshShell method CreateShortcut to create a WshUrlShortcut object.

WshUrlShortcut Properties

The WshUrlShortcut object has two properties:

WshUrlShortcut Methods

The WshUrlShortcut object has one method:

Категории