WSH 2.0 Versus 5.6

WSH 2.0 comes bundled with Windows 2000 and Windows 98, while WSH 5.6 comes bundled with Windows Server 2003 and Windows XP. WSH is also available for download for Windows 95 and Windows NT. Do not be alarmed by the dramatic increase in version numbers; 5.6 was the next major version after 2.0. In fact, for most people writing scripts, the differences between 2.0 and 5.6 are not significant enough to worry about. Version 5.6 offers a new security model and perhaps most importantly, the ability to execute scripts remotely.

As of WSH 2.0, two types of file formats are supported. The first is the traditional script files, which contain pure VBScript or JScript and have a language-specific file extension (e.g., .vbs), and the second is Windows Script File (WSF), which has a .wsf extension.

WSF is actually an Extensible Markup Language (XML) file, with the scripting code embedded inside <script>...</script> tags, which is embedded in <job>...</job> tags. The following example shows how the SIMPLE.VBS example would look using the WSF format:

<script language="VBScript">

MsgBox "Hello World"


The XML specifies that the file contains a single script (a job) and that the script to be run is written in VBScript. At its simplest, to write WSF scripts with VBScript instead of the traditional script files, all you have to do is prefix your code with the first two lines and end your code with the last two lines as shown in SIMPLE.VBS.

I encourage you to find ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.