Windows Script File

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
(Created page with "{{FormatInfo |formattype=Languages |subcat=Programming Languages |extensions={{ext|wsf}} |released=1981 |pronom={{PRONOM|x-fmt/413}} }} '''Windows Script File''' is a file co...")
 
Line 10: Line 10:
  
 
This is an XML based format and it uses <code>&lt;script&gt;</code> tags to implement each of the script bodies. Often the body will be also wrapped in the <code>CDATA</code> in order to prevent accidents with using XML like tags within the executable code, that would otherwise prevent parsing of the file.
 
This is an XML based format and it uses <code>&lt;script&gt;</code> tags to implement each of the script bodies. Often the body will be also wrapped in the <code>CDATA</code> in order to prevent accidents with using XML like tags within the executable code, that would otherwise prevent parsing of the file.
 +
 +
==Examples==
 +
===Example 1 - Hello World===
 +
<pre>
 +
<?xml version="1.0" ?>
 +
<job>
 +
  <script language='VBScript'><![CDATA[
 +
 +
    wscript.echo 'Hello World!'
 +
 +
  ]]></script>
 +
</job>
 +
</pre>
 +
 +
===Example 2 - Interlanguage Hello World===
 +
<pre>
 +
<?xml version="1.0" ?>
 +
<job>
 +
  <script language='JScript'><![CDATA[
 +
    function helloWorld()
 +
    {
 +
      WScript.Echo("Hello World");
 +
    }
 +
  ]]</script>
 +
  <script language='VBScript'><![CDATA[
 +
 +
    helloWorld
 +
 +
  ]]></script>
 +
</job>
 +
</pre>
  
 
==External link==
 
==External link==

Revision as of 11:59, 3 October 2016

File Format
Name Windows Script File
Ontology
Extension(s) .wsf
PRONOM x-fmt/413
Released 1981


Windows Script File is a file containing scripts in different language (by default VBScript and Javascript are supported, but other languages can be enabled by the user after the installation of their respective interpreters).

This is an XML based format and it uses <script> tags to implement each of the script bodies. Often the body will be also wrapped in the CDATA in order to prevent accidents with using XML like tags within the executable code, that would otherwise prevent parsing of the file.

Contents

Examples

Example 1 - Hello World

<?xml version="1.0" ?>
<job>
  <script language='VBScript'><![CDATA[

    wscript.echo 'Hello World!'

  ]]></script>
</job>

Example 2 - Interlanguage Hello World

<?xml version="1.0" ?>
<job>
  <script language='JScript'><![CDATA[
    function helloWorld()
    {
      WScript.Echo("Hello World");
    }
  ]]</script>
  <script language='VBScript'><![CDATA[

    helloWorld

  ]]></script>
</job>

External link

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox