Marks the beginning and the end of a job within a Windows Script file (*.wsf).
<job [id=JobID]> job code </job>
Each jobID within a Windows Script file must be unique.
Each script within a set of job tags is executed in sequence, from top to bottom.
A job contains one or more script blocks. A script block is any script code between a set of <script> tags. A script block can contain several scripts, and each script can be in a different scripting language.
To run a specific job or to run multiple jobs, use the //Job switch. If you specify more than one job, the jobs are executed in sequential order. (This is shown in the example below.). If you do not specify a job, only the first job is run. If you have two or more jobs in your Windows Script file, they must be enclosed in a <package> tag.
The following script example is a Windows Script file called myScript.wsf
. This file contains two separate jobs, each written in a different scripting language. The first job, written in VBScript, is given the identifier DoneInVBS
. The second job, written in JScript, is given the identifier DoneInJS
.
<package><job
id="DoneInVBS">
<?job debug="true"?> <script language="VBScript"> WScript.Echo "This is VBScript" </script></job>
<job
id="DoneInJS">
<?job debug="true"?> <script language="JScript"> WScript.Echo("This is JScript"); </script></job>
</package>
To run the second job in the Windows Script file, myScript.wsf, type the following at the command prompt.
cscript myScript.wsf //job:DoneInJS
To run both jobs in myScript.wsf
, type the following at the command prompt.
cscript myScript.wsf//job:DoneInVBS
//job:DoneInJS
ShowUsage Method | <runtime> Element | <named> Element | <unnamed> Element | <description> Element | <example> Element