Running Scripts from the Command PromptĀ
Windows Script Host enables you to run scripts from the command prompt. CScript.exe provides command-line switches for setting script properties.
Procedures
To run scripts using CScript.exe
Type a command at the command prompt using the following syntax:
cscript [host options...] [script name] [script options and parameters]
Host Options enable or disable various Windows Script Host features. Host options are preceded by two slashes (//).Script name is the name of the script file with extension and necessary path information, for example, d:\admin\vbscripts\chart.vbs
. Script options and parameters are passed to the script. Script parameters are preceded by a single slash (/).
Each parameter is optional; however, you cannot specify script options without specifying a script name. If you do not specify parameters, CScript displays the CScript syntax and the valid host parameters.
CScript Example
Several sample scripts, which are installed along with Windows Script Host, are also available for download at (https://msdn.microsoft.com/scripting).
Suppose, for the purposes of this example, that you have copied the Chart.vbs sample script to the following folder on your computer:
c:\sample scripts\chart.vbs
You can run the script with and without a logo as follows.
To run a script with or without a logo
Start the MS-DOS command prompt.
Enter the following commands at the command prompt (modify accordingly if your sample scripts are located in a different folder):
cscript //logo c:\"sample scripts"\chart.vbs cscript //nologo c:\"sample scripts"\chart.VBScript
See Also
Concepts
Running Scripts from Windows
What to Include to Run a Script
WScript.exe and CScript.exe Options