JSI Tip 2825. How do I change the default script host from Wscript to Cscript or visa versa?


We discussed the Windows Scripting Host (WSH) in tip 2531.

The default scripting engine for Windows 2000 is Wscript. If you use Cscript more often, you may wish to change the default, to eliminate the need to type Cscript before each file.

To change the default, type:

cscript //h:cscript //s

Typing cscript /? generates:

Microsoft (R) Windows Script Host Version 5.1 for Windows
Copyright (C) Microsoft Corporation 1996-1999. All rights reserved.

Usage: CScript scriptname.extension \[option...\] \[arguments...\]

Options:
 //B         Batch mode: Suppresses script errors and prompts from
             displaying
 //D         Enable Active Debugging
 //E:engine  Use engine for executing script
 //H:CScript Changes the default script host to CScript.exe
 //H:WScript Changes the default script host to WScript.exe (default)
 //I         Interactive mode (default, opposite of //B)
 //Job:xxxx  Execute a WS job
 //Logo      Display logo (default)
 //Nologo    Prevent logo display: No banner will be shown at 
             execution time
 //S         Save current command line options for this user
 //T:nn      Time out in seconds:  Maximum time a script is permitted 
             to run
 //X         Execute script in debugger
 //U         Use Unicode for redirected I/O from the console
Typing wscript /? generates:
Usage: WScript scriptname.extension \[option...\]\[arguments...\]

Options:
 //B           Batch mode: Suppresses script errors and prompts
               from displaying
 //D           Enable Active Debugging
 //E:engine    Use engine for executing script
 //H:Cscript   Changes the Default script host to CScript.exe
 //H:Wscript   Changes the default script host to WScript.exe
 //I           Interactive mode(default, opposite of //B)
 //Job:xxx     Execute a WS job
 //Logo        Display logo(default)
 //Nologo      Prevent logo display: No banner will be shown
               at execution time
 //S           Save current command line options for the user
 //T:nn        Time out in seconds: Maximum time a script is 
               permitted to run
 //X           Execute script in debugger



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish