How Windows Scripting Host Uses the Registry
An ActiveX scripting engine is registered for use with Windows Scripting Host by adding registry entries under the HKEY_CURRENT_USER (HKCU) key. Windows Scripting Host determines which scripting engine to use to execute a script by examining the ScriptEngine key. For example, if a user types the following command in a Command Prompt window to look up the scripting engine for the Chart.vbs file:
cscript chart.vbs
Windows Scripting Host does the following:
-
Searches HKCU\.vbs to obtain a script identifier, such as VBSfile.
-
Searches HKCU\VBSFile\ScriptEngine to get a scripting engine identifier, such as VBScript.
-
Finds the CLSID from the scripting engine identifier; in this example, the CLSID is located in HKCU\VBScript\CLSID.
-
Calls CoCreateInstance with the CLSID and IUnknown.
-
Calls QueryInterface to get the IActiveScriptParse COM interface.
© 1997 by Microsoft Corporation. All rights reserved.