Microsoft® Windows® Script Host About Windows Script Host |
WSH Tutorial Previous Next |
Microsoft® Windows® Script Host is a language-independent scripting host for ActiveX® scripting engines. It brings simple, powerful, and flexible scripting to the Windows 32-bit platform, allowing you to run scripts from both the Windows desktop and the command prompt.Windows Script Host is ideal for non-interactive scripting needs such as logon scripting, administrative scripting, and machine automation.
Windows Script Host offers the following benefits:
- Two separate executable files, WScript.exe and CScript.exe, for running scripts either from Windows or from the command prompt. WScript.exe provides a Windows-based properties page for setting script properties, while CScript.exe provides command-line switches for setting script properties.
- Support for multiple files. You can call multiple scripting engines and perform multiple jobs from a single Windows Script (.wsf) file.
- Very low memory requirements.
- Mapping of script extensions to programmatic identifiers (ProgIDs). When you start a script from the Windows desktop or the command prompt, the script host reads and passes the specified script file contents to the registered script engine. Instead of using the HTML SCRIPT tag to identify the script, the host uses file extensions; for example, .vbs for Microsoft Visual Basic® Scripting Edition (VBScript) files, and .js for Microsoft JScript® files. The use of extensions means you no longer need to be familiar with the ProgID for a given script engine. Windows Script Host handles this for you by maintaining a mapping of script extensions to ProgIDs, launching the appropriate engine for a given script.
Windows Script Host Object Model
Windows Script Host provides ActiveX interfaces for direct manipulation of script execution, as well as helper functions for other actions. The Windows Script Host Reference documents elements, methods, objects, and properties with which you can accomplish tasks such as the following:
- Print messages to the screen
- Run basic functions such as CreateObject and GetObject
- Map network drives
- Connect to printers
- Retrieve and modify environment variables
- Modify registry keys
Windows Script Host Integration
Windows Script Host is integrated into Windows 98, Windows 2000 Professional, and Windows 2000 Server. Version 2.0 includes the VBScript and JScript scripting engines. In the future, other software companies may provide ActiveX scripting engines for languages such as PerlScript, TCL, REXX, and Python.