please dont rip this site

Windows Scripting Host:
A Universal Scripting Host for Scripting Languages





© 1996 Microsoft Corporation. All rights reserved.

The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication.

This White Paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT.

Microsoft, Windows, Windows NT, MS-DOS andVisual Basic are registered trademarks and ActiveX is a trademark of Microsoft Corporation.

Other product or company names mentioned herein may be the trademarks of their respective owners.

Microsoft Corporation • One Microsoft Way • Redmond, WA 98052-6399 • USA






The Windows Scripting Host (WSH) is a language-independent scripting host for 32-bit Windows platforms. Windows Scripting Host will be integrated into Windows® 95 updates, Windows NT® Workstation version 5.0, and Windows NT Server version 5.0.


Introduction *

The BENEFITS of Windows Scripting host *

Implementing More Powerful Scripts *

Windows Scripting Options *

Running Scripts Using the Command-based Scripting Host *

Command Syntax *

A WSH Command Example *

Running Scripts Using the Windows-based Scripting Host *

WSH Architectual Overview *

The Windows Scripting Host (WSH) is a language-independent scripting host for 32-bit Windows platforms. Microsoft provides both Visual Basic® Script and Java Script scripting engines with WSH. Microsoft anticipates that other software companies will provide ActiveX™ scripting engines for other languages such as Perl, TCL, REXX, and Python.

WSH can be run from either the Windows-based host (WSCRIPT.EXE), or the command shell-based host (CSCRIPT.EXE).

This white paper describes:

  • the uses of WSH
  • how to install WSH
  • how to use WSH

WSH will be integrated into Windows 95 updates, Windows NT Workstation version 5.0, and Windows NT Server version 5.0.

Windows Scripting Host (WSH ) brings simple, powerful, and flexible scripting to the 32-bit Windows platform.

Implementing More Powerful Scripts

Previously, the only native scripting language supported by the Windows operating system was the MS-DOS® command language. Although it is fast and small, MS-DOS has limited features compared to Visual Basic Script and Java Script. Today, ActiveX scripting architecture allows users to take advantage of powerful scripting languages such as Visual Basic Script and Java Script. And MS-DOS command scripts are still supported.

Windows Scripting Options

ActiveX scripting architecture enables powerful scripting using languages such as VB Script, Java Script, and Perl. Microsoft currently provides three hosts for running these scripting languages across the Windows platform:

Internet Explorer enables scripts to be executed on client machines from within HTML pages.

Internet Information Server now supports Active Server Pages, which

enables scripts to be run on Web servers; in other words, it enables

server-side scripting over the Internet or an intranet.

Windows Scripting Host enables scripts to be executed directly on the Windows desktop or command console, without the need to embed those scripts in an HTML document. Scripts can be run directly from the desktop simply by clicking on a script file, or from the command console. WSH provides a low-memory scripting host that is ideal for non-interactive scripting needs such as logon scripting, administrative scripting, and so on.

Command Syntax

CSCRIPT.EXE uses the following syntax:

cscript [host options…] [script name] [script options]

Each parameter is optional; however, you cannot specify script parameters without specifying a script. If you don’t specify parameters, CSCRIPT.EXE displays the CSCRIPT.EXE syntax and the valid host parameters.

CSCRIPT.EXE supports the following host parameters:




Reregister the well known script extensions (.VBS, .JS, .TCL, ) by searching for well known registered script engines.
NOTE You don’t need to provide a script file name when using the //R switch.


Interactive Mode (Default - Opposite of //B)


Batch Mode. Suppress ALL non-command line console UI requested from script.


Time out in seconds. Maximum time the script can run (Default = No limit).

This option is used to prevent excessive execution of scripts; it does this by setting a watchdog timer. When execution time exceeds the specified value, CSCRIPT interrupts the script engine using the IActiveScript::InterruptThread method and terminates the process.

NOTE There is a callback hook here. In the event that that the time-out is invoked, the "OnTimeOut( )" subroutine will be called to permit some cleanup. While it is possible to create infinite loops using this feature, it is more useful that harmful.


Display an execution banner at exec time (Default - Opposite of //NoLogo).


Prevent Display of execution banner at exec time>.


Make CSCRIPT.EXE the default application for running scripts.


Save current command line options for this user (per user).


Show command usage (same as execution with no parameters).


A WSH Command Example

Several sample scripts are installed when you install the test release of WSH. The sample scripts are in the %windir%\WCSample folder (where %windir% is your Memphis folder).

For example, to run CHART.VBS:

  1. Run the Memphis MS-DOS command prompt.
  2. Run the following commands:

cscript //logo %windir%\wcsample\chart.vbs

cscript //nologo %windir%\wcsample\chart.vbs

Additional sample scripts can be found in the \betaonly\wsh\samples directory on your CD.

There are three ways to run scripts under windows using WSH. You can:

When you run scripts from WSCRIPT.EXE, you can select the Always Use the Windows Scripting Host to open this file check box and set properties on the WSH Properties page.

When you run a script and the Always Use the Windows Scripting Host to open this file check box is selected, WSCRIPT.EXE is registered as the default application to run files with the extension of the script you are running. For example, if you select the check box when you run CHART.VBS, WSCRIPT.EXE becomes the default application for all files with the .VBS extension. This check box functions identically to the CSCRIPT.EXE //C switch.

The WSH Properties page provides the following options:


Use to…

CSCRIPT.EXE equivalent

Register common script extensions

Re-register the well known script extensions (.VBS, .JS, .TCL, ) by searching for well known registered script engines.


Stop script after nn seconds

Specify a maximum number of seconds that a script may run. (The default is no limit.)


By default, run scripts in the following mode:

Suppress or enable all non-command line console UI requests from the script. Interactive allows non-command line console UI requests, Batch does not.

//I & //B

The Windows Scripting Host serves as a controller of ActiveX Scripting engines, just as Microsoft Internet Explorer does. Because the scripting host is not a full Internet browser, it has a smaller memory footprint than Microsoft Internet Explorer; therefore, WSH is appropriate for performing simple, quick tasks.

The scripting host reads and passes the specified script file contents to the registered script engine via the IActiveScriptParse::ParseScriptText method provided by the script engine.






















The scripting engine does not use the SCRIPT tag (used in HTML); instead it relies on the extension of the file. This way, the script writer doesn’t have to be familiar with the exact ProgID of various script engines. The scripting host maintains a mapping of the script extensions to ProgIDs and uses the Windows association model to launch the appropriate engine.

file: /Techref/os/win/win98/wsh_info.htm, 14KB, , updated: 1999/2/20 13:29, local time: 2024/7/16 05:30,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> &#9;</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?


Welcome to!


Welcome to!