Microsoft® Windows® Script Host <script> Element |
WSH Reference Version 2 |
XML element that contains script to define the behavior of a Windows Script component.
<script language="language" [src="strFile"]>
script here
</script>
Part Description language The name of the scripting language used in the Windows Script component file, such as Microsoft Visual Basic® Scripting Edition (VBScript) or Microsoft JScript®. strFile The name of the script file to include into the <script> block.
If XML validation is not enabled, the XML parser ignores all lines inside the <script> element. However, if XML validation is enabled by including the <?XML ?> declaration at the top of the script component file, the XML parser can misinterpret greater than (>), less than (<), and other symbols used in script as XML delimiters.If you are creating a file that conforms closely to XML syntax, you must ensure that characters in your script element are not treated as XML-reserved characters. To do this, enclose the actual script in a <![CDATA[ ... ]]> section.
Note: Do not include a CDATA section unless you also include the <?XML ?> declaration.
The following example incorporates two jobs into one .wsf file using two different scripting languages:<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>