Name

Windows Script Host — \windows\system32\wscript.exe; cscript.exe

Synopsis

Runs WSH scripts.

To Open

Command Prompt wscript

Command Prompt cscript

Usage

wscript filename [options] [arguments]
cscript filename [options] [arguments]

Description

The Windows Script Host runs WSH script files you create and edit. Of the two executables, wscript.exe is used to run Windows-based scripts, and cscript.exe is for running command-prompt based scripts. For more information on the Windows Script Host, see Chapter 8.

Both executables take the following options (note the use of double slashes to distinguish them from ordinary arguments passed onto the script):

//b

Batch mode: suppresses script errors and prompts from displaying.

//d

Enables active debugging.

//e: engine

Uses engine for executing the script; the default depends on the filename extension of the script file.

//h: cscript

Changes the default script host to cscript.exe, the command-prompt-based host.

//h: wscript

Changes the default script host to wscript.exe, the Windows-based host (the default).

//job: xxxx

Executes a WSF job.

//nologo

Prevents the display of the banner logo at execution time.

//s

Saves current command line options as the default for this user.

//t: nn

Timeout in seconds: the maximum time a script is permitted to run.

//x

Executes script in debugger.

//u

Uses Unicode for redirected I/O from the console.

Get Windows XP in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.