WSH Language Elements

All the language elements listed in Table 7.24 have been added to Windows Script Host as of Version 2.0, largely in an effort to add XML support to WSH, as well as to increase its flexibility and its suitability for scripting by computer professionals. In order to use these language elements, the file must end with an extension of .wsf rather than .vbs.

Table 7-24. WSH Language Elements

Element

Description

                              <?job ?>

Defines error handling. It syntax is <?job error="flag" debug="flag" ?> where flag is the string “True” or “False”, “Yes” or “No”, or the integers 1 or 0. The error attribute defines whether the user will be notified of errors; the debug attribute determines whether a debugger is launched when an error is raised. By default, both attributes are False.

                              <?xml ?>

Indicates that the contents of a file should be parsed as XML. Its syntax is <?XML version="version" [standalone="DTDflag“] ?> where version is a string in the format n.n that indicates the XML level of the file, and DTDflag is a Boolean value that indicating whether the XML file includes a reference to an external DTD. Since script files do not include DTDs, the value of this attribute must always be “yes.” The <?xml ?> tag must be the first element in the file, and cannot be preceded by any blank lines. Its most common use is to indicate that the script file can be edited by an XML editor.

                              <job>
script
</job>

Defines an individual job within a script file containing one or more ...

Get VBScript in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.