Running Scripts Using the Command-Based Scripting Host

Command Syntax

Cscript.exe uses the following syntax:

CScript scriptname.extension [option...]  [arguments...]

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:

Parameter Description
//I Interactive Mode (Default - Opposite of //B)
//B Batch Mode. Suppresses script errors and user prompts from displaying on screen
//T:nn Timeout 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 by using the IActiveScript::InterruptThread method and terminates the process.
//logo Display an execution banner at exec time (Default - Opposite of //NoLogo).
//nologo Prevent Display of execution banner at exec time.
//H:Cscript or Wscript Make Cscript.exe or Wscript.exe the default application for running scripts.Default=Wscript.exe
//S Save current command line options for this user (per user).
//? Show command usage (same as execution with no parameters).

A Windows Scripting Host Command Example

Several sample scripts are installed when you install the final release of Windows Scripting Host. The sample scripts are also available by downloading the Sample Scripts package located at: http://www.microsoft.com/management/wsh.htm

For example, to run Chart.vbs:

  1. Run the MS-DOS command prompt from the Start menu, Programs.
  2. Run the following commands:
    cscript //logo "drive:"\"your sample directory"\chart.vbs
    cscript //nologo "drive:"\"your sample directory"\chart.vbs

© 1997 by Microsoft Corporation. All rights reserved.