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:

  1. Searches HKCU\.vbs to obtain a script identifier, such as VBSfile.
  2. Searches HKCU\VBSFile\ScriptEngine to get a scripting engine identifier, such as VBScript.
  3. Finds the CLSID from the scripting engine identifier; in this example, the CLSID is located in HKCU\VBScript\CLSID.
  4. Calls CoCreateInstance with the CLSID and IUnknown.
  5. Calls QueryInterface to get the IActiveScriptParse COM interface.