|
|
HOME |
|
RESOURCES |
|
DOWNLOADS |
|
VISUAL STUDIO BLOG |
|
CONTACT |
| NOTE: You can type wscript /? at the command prompt to see the syntax for Windows Scripting Host. |
Windows Script Host provides several objects for direct manipulation of script execution, as well as helper functions for other actions. Using these objects and services, you can accomplish tasks such as the following:
Windows Script Host is built into Microsoft Windows 98, 2000, and Millennium Editions. If you are running Windows 95, you can download Windows Script Host 5.6 from the Microsoft Windows Script Technologies Web site (http://msdn.microsoft.com/scripting).
Note You can also go to the web site listed above to upgrade your current engines. The version of WSH in Windows 98, 2000, and Millennium Editions is either version 1.0 or 2.0. You must upgrade to version 5.6 to get the new features.
The illustration that follows represents the Windows Script Host Object Model hierarchy. Click an object in the diagram to see its associated Help topic.
The Windows Script Host object model provides a logical, systematic way to perform many administrative tasks. The set of COM interfaces it provides can be placed into two main categories:
This set of interfaces allows scripts to perform basic manipulation of the Windows Script Host, output messages to the screen, and perform basic COM functions such as CreateObject and GetObject.
Helper functions are properties and methods for performing actions, such as mapping network drives, connecting to printers, retrieving and modifying environment variables, and manipulating registry keys. Administrators can also use the Windows Script Host helper functions to create simple logon scripts.
The following table is a list of the WSH objects and the typical tasks associated with them.
| Object | What you can do with this object |
|---|---|
| Wscript |
|
| WshArguments | Access the entire set of command-line arguments |
| WshNamed | Access the set of named command-line arguments |
| WshUnnamed | Access the set of unnamed command-line arguments |
| WshNetwork |
|
| WshController | Create a remote script process using the Controller method CreateScript() |
| WshRemote |
|
| WshRemote Error | Access the error information available when a remote script (a WshRemote object) terminates as a result of a script error |
| WshShell |
|
| WshShortcut | Programmatically create a shortcut |
| WshSpecialfolders | Access any of the Windows Special Folders |
| WshURLShortcut | Programmatically create a shortcut to an Internet resource |
| WshEnvironment | Access any of the environment variables (such as WINDIR, PATH, or PROMPT) |
| WshScriptExec | Determine status and error
information about a script run with Exec()
Access the StdIn, StdOut, and StdErr channels |
In addition to the object interfaces provided by Windows Script Host, administrators can use any ActiveX control that exposes automation interfaces to perform various tasks on the Windows platform. For example, administrators can write scripts to manage the Windows Active Directory Service Interface (ADSI).
Source : Microsoft MSDN