0% found this document useful (0 votes)
279 views

Running Scripts With CScript

CScript.exe allows running scripts from the command prompt. It uses the syntax "cscript [host options...] [script name] [script options and parameters]". Host options enable or disable Windows Script Host features and are preceded by two slashes. Script name specifies the script file. Script options and parameters are passed to the script and preceded by a single slash. CScript supports host options like //I for interactive mode and //B for batch mode. The //T parameter sets a time-out limit for script execution. The document provides an example of running the Chart.vbs sample script with and without logos using CScript.

Uploaded by

Basavaraju K R
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
279 views

Running Scripts With CScript

CScript.exe allows running scripts from the command prompt. It uses the syntax "cscript [host options...] [script name] [script options and parameters]". Host options enable or disable Windows Script Host features and are preceded by two slashes. Script name specifies the script file. Script options and parameters are passed to the script and preceded by a single slash. CScript supports host options like //I for interactive mode and //B for batch mode. The //T parameter sets a time-out limit for script execution. The document provides an example of running the Chart.vbs sample script with and without logos using CScript.

Uploaded by

Basavaraju K R
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

3/20/2016

RunningScriptswithCScript.exe

ClickheretoshowtoolbarsoftheWebOnlineHelpSystem:showtoolbars

MicrosoftWindowsScriptHost

RunningScriptswith
CScript.exe

WSHTutorial
Previous
Next

CScript.exeistheversionofWindowsScriptHostthatenablesyoutorunscriptsfromthe
commandprompt.CScript.exeprovidescommandlineswitchesforsettingscriptproperties.Touse
CScript.exe,typeacommandlineatthecommandpromptusingthefollowingsyntax:

cscript[hostoptions...][scriptname][scriptoptionsandparameters]
wherethetermsaredefinedasfollows:

HostoptionsenableordisablevariousWindowsScriptHostfeatures.Hostoptionsare
precededbytwoslashes(//).

Scriptnameisthenameofthescriptfile,completewithextensionandanynecessary
pathinformation,suchas:d:\admin\vbscripts\chart.vbs.

Scriptoptionsandparametersarepassedtothescript.Scriptparametersare
precededbyasingleslash(/).
Eachparameterisoptionalhowever,youcannotspecifyscriptoptionswithoutspecifyingascript
name.Ifyoudonotspecifyparameters,CScriptdisplaystheCScriptsyntaxandthevalidhost
parameters.CScript.exesupportsthehostoptionsshowninthefollowingtable.
Parameter

Description

//I

Interactivemode:allowsdisplayofuserpromptsandscripterrors
(thisisthedefault,andtheoppositeof//B).

//B

Batchmode:suppressescommandlinedisplayofuserpromptsand
scripterrors.

//T:nn

Enablestimeout:themaximumnumberofsecondsthescriptcanrun.
Thedefaultisnolimit.(Seethetextfollowingthistableformore
informationonthisparameter.)

//logo

Default.Displaysabanner(oppositeof//nologo).

//nologo

Preventsdisplayofanexecutionbanneratruntime.

//H:CScript RegistersCScript.exeorWScript.exeasthedefaultapplicationfor
or
runningscripts.Ifneitherisspecified,WScript.exeisassumedasthe
//H:WScript default.
//S

Savesthecurrentcommandlineoptionsforthisuser.

//?

Showscommandusage(sameaswithparameters).

//E:engine

Executesthescriptwiththespecifiedscriptingengine.

//D

Turnsonthedebugger.

//X

Launchestheprograminthedebugger.

//Job:
<JobID>

RunsthespecifiedJobIDfromthe.wsffile.

The//Tparameterpreventsexcessiveexecutionofscriptsbysettingatimer.Whenexecutiontimeexceedsthespecifiedvalue,
CScriptinterruptsthescriptingengineusingtheIActiveScript::InterruptThreadmethodandterminatestheprocess.

ACScriptExample

SeveralsamplescriptsareinstalledwhenyouinstallthefinalreleaseoftheWindowsScriptHost.
Thesearealsoavailablefordownloadat:http://msdn.microsoft.com/scripting
Suppose,forthepurposesofthisexample,thatyouhavecopiedtheChart.vbssamplescripttothefollowingfolderonyour
computer:

http://education.dewsoftoverseas.com/QE/QUickReference/WSH/htm/wsruncscript.htm

1/2

3/20/2016

RunningScriptswithCScript.exe
c:\samplescripts\chart.vbs
Youcanrunthescriptwithandwithoutalogo,asfollows:

1.ChoosetheMSDOSoperatingsystemcommandpromptfromProgramsontheStart
menu.
2.Enterthefollowingcommandsatthecommandprompt(modifyaccordinglyifyoursample
scriptsarelocatedinadifferentfolder):

cscript//logoc:\"samplescripts"\chart.vbs
cscript//nologoc:\"samplescripts"\chart.vbs
Dewsoft

http://education.dewsoftoverseas.com/QE/QUickReference/WSH/htm/wsruncscript.htm

2/2

You might also like