- Understanding Windows Script Host
- Introducing Script Files
- Running Script Files Directly
- Using WScript for Windows-Based Scripts
- Using CScript for Command-Line Scripts
- Script Properties and .wsh Files
Using CScript for Command-Line Scripts
The Windows Script Host has a second host front-end application called CScript (CScript.exe), which enables you to run scripts from the command line. In its simplest form, you launch CScript and use the name of the script file (and its path, if required) as a parameter, as in this example:
cscript myscript.vbs
The Windows Script Host displays the following banner and then executes the script:
Microsoft (R) Windows Script Host Version 5.6 for Windows Copyright (C) Microsoft Corporation. All rights reserved.
As with WScript, the CScript host has an extensive set of parameters you can specify:
CSCRIPT [filename] [arguments] [//B] [//D] [//E:engine] [//H:host] [//I] [//Job:xxxx] [//S] [//T:ss] [//X] [//LOGO | //NOLOGO] [//U]
This syntax is almost identical to that of WScript, but it adds the following three parameters:
//LOGO |
Displays the Windows Script Host banner at startup |
//NOLOGO |
Hides the Windows Script Host banner at startup |
//U |
Uses Unicode for redirected input/output from the console |