Section A.2. WSH 2.0 Versus 5.6


A.2. 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:

<job> <script language="VBScript"> MsgBox "Hello World" </script> </job>

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 out more about WSH to fully utilize its capabilities. For more information on WSH, including advanced functionality and running scripts using WSF, see the Microsoft Scripting web site: http://msdn.microsoft.com/scripting/.

with Alistair Lowe-Norris



Windows Server Cookbook
Windows Server Cookbook for Windows Server 2003 and Windows 2000
ISBN: 0596006330
EAN: 2147483647
Year: 2006
Pages: 380
Authors: Robbie Allen

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net