Windows Script File
From Wikipedia, the free encyclopedia
Windows Script File | |
File extension: | .wsf |
---|---|
Developed by: | Microsoft |
Type of format: | Scripting |
Container for: | Scripts |
A Windows Script File (WSF) allows developers to make more and independent scripts by allowing a mixture of Perl, JScript, and VBScript within one file. One benefit is that this allows developers of different skill sets to work together. These types of scripts may also be used to link many other external scripts together using a "src" parameter on the "<script>" tag in a manner similar to HTML. A WSF references each script module in a very basic XML hierarchy as illustrated below.
A WSF may be useful for isolating errors. Its modular nature prevents one script reference from interfering with another. Here is a WSF example with one module that produces an error and one that does not:
<job id="Partially works"> '** This will not work <script language="VBScript"> WScript.echo 4/0 ' Oh boy! You cannot divide by zero... </script> '** This will work... definitely... <script language="VBScript"> WScript.echo "Hello Scripters!" & vbNewline & _ "Fantastic! It worked!" </script> </job>
The first script module will produce a "divide by zero" error. Typically this would cause the script to end in the Windows Script Host but this modular method allows the script to continue and execute the second script module.
Windows Script Files have a Windows extension of ".wsf" so to test the code above you would open a text file and save it as "HelloScripters.wsf" and then simply double-click the resulting file to execute it (granted you have not changed your default file extension execution-reference for .wsf files and you are displaying the extensions for known file types).
[edit] External links
Using Windows Script Files - From Microsoft's website