WSF - Windows Script File XML Format

This section describes the WSF (Windows Script File) XML format. Multiple script jobs with different scripting language can be defined in a single WSF file.

WSH can run a VBScript code file directly. But it also supports an XML file format called .WSF (Windows Script File). WSF file offers an XML structure to define script jobs and group jobs into a package.

WSF supports the following basic XML elements:

Here is a tutorial example of a WSF file:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Windows_Script_File.vbs
 - Copyright (c) 2015,, All Rights Reserved.
   <job id="VBScriptJob">
      <script language="VBScript">
         WScript.Echo "Hello world! - VBScriptJob"

   <job id="JScriptJob">
      <script language="JScript">
         WScript.Echo("Hello world! - JScriptJob"); 
   <job id="MixedJob">
      <script language="VBScript">
         Dim sName
         sName = "MixedJob"
      <script language="JScript">
         WScript.Echo("Hello world! - "+sName); 

Jobs defined in this WSF file can be executed with WSH hosts as shown below:

C:\herong>cscript //Job:VBScriptJob Windows_Script_File.wsf

Hello world! - VBScriptJob

C:\herong>cscript //Job:JScriptJob Windows_Script_File.wsf

Hello world! - JScriptJob

C:\herong>cscript //Job:MixedJob Windows_Script_File.wsf

Hello world! - MixedJob

Note that:

Table of Contents

 About This Book

 Introduction of VBScript - Visual Basic Scripting Edition

 Variant Data Type, Subtypes, and Literals

 Arithmetic Operations

 Numeric Comparison Operations and Logical Operations

 String Operations - Concatenation and Comparison

 Variable Declaration and Assignment Statement

 Expression and Order of Operation Precedence

 Statement Syntax and Statement Types

 Array Data Type and Related Statements

 Array References and Array Assignment Statements

 Conditional Statements - "If ... Then" and "Select Case"

 Loop Statements - "For", "While", and "Do"

 "Function" and "Sub" Procedures

 Built-in Functions

 Inspecting Variables Received in Procedures

 Error Handling Flag and the "Err" Object

 Regular Expression Pattern Match and Replacement

 scrrun.dll - Scripting Runtime DLL Library

 Creating Your Own Classes

 IE Web Browser Supporting VBScript

 IIS ASP Server Supporting VBScript

WSH (Windows Script Host)

 What is WSH (Windows Script Host)?

 "csript.exe/wscript.exe" Command Version and Options

 Running VBScript Code Files

 "WScript" Runtime Object Hierarchy

 "oShell.Exec(cmd)" - Running System Command with a Script

WSF - Windows Script File XML Format


 PDF Printing Version