Documentation

    Table of Content
    • 3D File Formats
      • 3D File Formats
      • 3D2
      • 3DM
      • 3DS
      • 3MF
      • AMF
      • ASE
      • B3D
      • DAE
      • DRC
      • E57
      • FBX
      • GLB
      • GLTF
      • IPT
      • JT
      • MA
      • MB
      • MP
      • OBJ
      • PLY
      • PRC
      • RVM
      • STEP
      • STP
      • U3D
      • USD
      • USDZ
      • VRML
      • X
      • X3D
    • Audio File Formats
      • Audio File Formats
      • 8SVX
      • AA
      • AAC
      • AAX
      • AC3
      • ACT
      • AIFF
      • ALAC
      • AMR
      • APE
      • CDA
      • DSS
      • FLAC
      • GSM
      • M3U
      • M3U8
      • M4A
      • M4B
      • M4P
      • MID
      • MKA
      • MMF
      • MOD
      • MP2
      • MP3
      • MPC
      • MXL
      • NSA
      • OGG
      • OPUS
      • RA
      • RF64
      • SDT
      • STAP
      • VOC
      • VOX
      • VQF
      • WAV
      • WFP
      • WMA
      • WPL
      • WV
    • CAD File Formats
      • CAD File Formats
      • ART
      • ASC
      • ASM
      • CATPART
      • CF2
      • DC3
      • DGN
      • DST
      • DWF
      • DWFX
      • DWG
      • DWT
      • DXF
      • FZP
      • HPGL
      • IFC
      • IGES
      • IGS
      • JVSG
      • NC
      • NWC
      • NWD
      • NWF
      • PAT
      • PHJ
      • PLT
      • PSM
      • PSS
      • RFA
      • RFT
      • RML
      • RVT
      • SLDPRT
      • STL
    • Compression File Formats
      • Compression File Formats
      • 7Z
      • ACE
      • ALZ
      • APK
      • ARC
      • ARJ
      • B6Z
      • BKF
      • BZ2
      • DAA
      • DAR
      • DEB
      • DMG
      • DZ
      • FZPZ
      • GZ
      • ICE
      • ISO
      • KGB
      • LBR
      • LQR
      • LZ
      • LZ4
      • LZH
      • LZMA
      • LZO
      • LZX
      • MBW
      • MINT
      • MPKG
      • MPQ
      • NPK
      • OAR
      • PAGES
      • PEA
      • PET
      • PKG
      • PTK
      • PUP
      • RAR
      • RPM
      • RTE
      • SIFZ
      • SITX
      • SY_
      • TAR
      • TBZ
      • TGS
      • TGZ
      • TPSR
      • TZ
      • VPK
      • WUX
      • XAPK
      • XAR
      • XZ
      • Z
      • ZIM
      • ZIP
      • ZIPX
      • ZL
    • Database
      • Database File Formats
      • 4DB
      • 4DD
      • ACCDB
      • ACCDC
      • ACCDE
      • ACCDR
      • ACCDT
      • ACCDW
      • ACCFT
      • ADB
      • ADE
      • ADF
      • ADN
      • ADP
      • ALF
      • ANB
      • AQ
      • ASK
      • BAK
      • BCP
      • BTR
      • CDB
      • DACPAC
      • DAT
      • DB
      • DB3
      • DBC
      • DBF
      • DDL
      • DTSX
      • FMP12
      • FMPSL
      • FP5
      • FP7
      • GDB
      • ITW
      • LDF
      • LOG
      • MDB
      • MDF
      • MYI
      • NDF
      • NSF
      • SAV
      • SDF
      • SQL
      • SQLITE
      • TE
      • TRC
      • TRM
      • UDL
      • WDB
    • Disc and Media
      • Disc and Media File Formats
      • BIN
      • CCD
      • CSO
      • CUE
      • GADGET
      • IMG
      • NKIT
      • NRG
      • OVA
      • OVF
      • ROM
      • SDI
      • Toast
      • UDF
      • VCD
      • VDI
      • VHD
      • WBFS
      • WIM
      • WUD
    • EBook File Formats
      • EBook File Formats
      • ACSM
      • AEP
      • APNX
      • AVA
      • AZW
      • AZW1
      • AZW3
      • AZW4
      • BKK
      • BPNUEB
      • CBC
      • CBR
      • CBZ
      • CEB
      • CEBX
      • DNL
      • EA
      • EAL
      • EBK
      • EDN
      • EPUB
      • ETD
      • FB2
      • FKB
      • HAN
      • HTML0
      • HTMLZ
      • HTXT
      • HTZ4
      • HTZ5
      • IBOOKS
      • KFX
      • KOOB
      • LIT
      • LRF
      • LRS
      • LRX
      • MART
      • MBP
      • MOBI
      • NCX
      • NVA
      • OEB
      • OEBZIP
      • OPF
      • ORB
      • PHL
      • PML
      • PMLZ
      • POBI
      • QMK
      • RB
      • RZB
      • RZS
      • SNB
      • TCR
      • TK3
      • TPZ
      • TR
      • TR3
      • VBK
      • WEBZ
      • YBK
    • Email File Formats
      • Email File Formats
      • EDB
      • EML
      • EMLX
      • ICS
      • MBOX
      • MSG
      • OFT
      • OLM
      • OST
      • P7S
      • PST
      • RPMSG
      • TNEF
      • VCF
    • Executable
      • Executable File Formats
      • AHK
      • BAT
      • BTAPP
      • CGI
      • CMD
      • COM
      • EXE
      • IPA
      • MSI
      • MST
      • PIF
      • PYC
      • REG
      • WSF
      • WSH
      • XBE
      • XEX
    • Finance
      • Finance File Formats
      • ABA
      • IXBRL
      • XBRL
    • Font
      • Font File Formats
      • BDF
      • CFF
      • CFF2
      • EOT
      • FNT
      • FON
      • JFPROJ
      • MFX
      • OTF
      • PFA
      • PFB
      • PFM
      • SFD
      • TTC
      • TTF
      • Type1
      • WOFF
    • Game File Formats
      • Game File Formats
      • BMZ
      • BNS
      • CLIP
      • CSD
      • CT
      • DEK
      • FOMOD
      • GAM
      • KODU
      • MCWORLD
      • MGX
      • PAK
      • PCC
      • PSS
      • PUP
      • PWF
      • REL
      • REP
      • RPX
      • SAV
      • SFAR
      • SID
      • U8
      • UMX
      • W3N
    • GIS File Formats
      • GIS File Formats
      • 000
      • 3D
      • 3DD
      • ADF
      • APL
      • APR
      • ATX
      • AUX
      • DEM
      • DIV
      • DLG
      • E00
      • ETA
      • FileGDB
      • FIT
      • GeoJSON
      • GLB
      • GMAP
      • GML
      • GPKG
      • GPX
      • IMG
      • KML
      • KMZ
      • LOC
      • MPS
      • NM2
      • NTF
      • OSM
      • QGD
      • QGS
      • QGZ
      • QLR
      • QML
      • SBN
      • SHP
      • SHX
      • SP3
      • SSF
      • TCX
    • Image File Formats
      • Image File Formats
      • AI
      • APNG
      • ART
      • AVIF
      • BMP
      • BPG
      • CDR
      • CLIP
      • CMX
      • CPC
      • CR2
      • CR3
      • CSL
      • CT
      • CUR
      • DCM
      • DCR
      • DCX
      • DDS
      • DIB
      • DICOM
      • DJVU
      • DNG
      • ECW
      • EMF
      • EMZ
      • EXIF
      • FLIF
      • FODG
      • GBR
      • GIF
      • HEIC
      • HEIF
      • ICNS
      • ICO
      • J2C
      • J2K
      • JFIF
      • JP2
      • JPC
      • JPEG
      • JPF
      • JPM
      • JPX
      • JXR
      • MNG
      • MP
      • MPO
      • NEF
      • ODG
      • OTG
      • PCX
      • PNG
      • PPP
      • PSB
      • PSD
      • PSP
      • PSPIMAGE
      • SKP
      • SVGZ
      • TGA
      • THM
      • TIFF
      • WEBP
      • WMF
      • WMZ
      • XPM
      • XPR
    • Misc File Formats
      • Misc File Formats
      • AML
      • ART
      • CTG
      • ENL
      • ERR
      • GPG
      • H4
      • H5
      • ICA
      • KLQ
      • MD5
      • MSO
      • OBB
      • ODF
      • OGG
      • PES
      • RIS
      • RML
      • SSP
      • THM
      • TORRENT
      • VIM
      • VIMRC
      • XMP
      • XSMX
    • Note Taking File Formats
      • Note Taking File Formats
      • ONE
      • ONETOC2
    • Page Description Language
      • Page Description Language
      • CGM
      • EPS
      • INDD
      • INDT
      • OXPS
      • PCL
      • PS
      • SVG
      • SWF
      • TEX
      • XPS
      • XSLFO
    • PDF
      • PDF
      • FDF
      • PDF/A
      • PDF/E
      • PDF/UA
      • PDF/VT
      • PDF/X
      • XFDF
    • Presentation File Formats
      • Presentation File Formats
      • KEY
      • ODP
      • OTP
      • POT
      • POTM
      • POTX
      • PPS
      • PPSM
      • PPSX
      • PPT
      • PPTM
      • PPTX
    • Programming
      • Programming
      • ABC
      • ADDIN
      • AML
      • ANE
      • APA
      • APKS
      • APPX
      • APPXBUNDLE
      • APPXUPLOAD
      • APS
      • ARSC
      • AS
      • ASM
      • AWK
      • C
      • CD
      • Class
      • CMAKE
      • CONFIG
      • CPP
      • CS
      • CSPROJ
      • CXX
      • Dart
      • DIFF
      • EGG
      • ERB
      • G4
      • GO
      • GROOVY
      • H
      • HAML
      • HH
      • HS
      • HTA
      • ICI
      • IN
      • IPR
      • JAR
      • Java
      • JRXML
      • JSP
      • JSPF
      • KT
      • LGO
      • LUA
      • M
      • MAKE
      • MEL
      • MF
      • ML
      • MM
      • MRC
      • MSIX
      • NUPKG
      • NUT
      • PAS
      • PDB
      • PDE
      • PHP
      • PL
      • PY
      • PYD
      • PYI
      • PYM
      • PYW
      • PYX
      • R
      • RBXL
      • RBXM
      • RES
      • RS
      • RST
      • SCALA
      • SCM
      • SCRIPT
      • SH
      • SLN
      • SWIFT
      • TCL
      • TOML
      • TS
      • VB
      • VBPROJ
      • VBS
      • VCXPROJ
      • XSD
      • YAML
      • YML
      • YPR
    • Project Management File Formats
      • Project Management File Formats
      • MPP
      • MPT
      • MPX
      • P6XML
      • XER
    • Publisher File Formats
      • Publisher File Formats
      • PUB
      • PUZ
    • Reporting
      • Reporting File Formats
      • MAR
      • RDL
      • RDLC
      • RPL
      • RPT
    • Spreadsheet File Formats
      • Spreadsheet File Formats
      • 123
      • 12M
      • _XLS
      • _XLSX
      • AST
      • AWS
      • BKS
      • CELL
      • CSV
      • DEF
      • DEX
      • DFG
      • DIF
      • DIS
      • EFU
      • ESS
      • FCS
      • FM
      • FODS
      • FP
      • GNM
      • GNUMERIC
      • IMP
      • MAR
      • NB
      • NUMBERS
      • NUMBERS-TEF
      • ODS
      • OTS
      • PMD
      • PMDX
      • PMVX
      • SDC
      • STC
      • SXC
      • TMV
      • TMVT
      • TSV
      • XAR
      • XL
      • XLA
      • XLAM
      • XLM
      • XLR
      • XLS
      • XLSB
      • XLSM
      • XLSMHTML
      • XLSX
      • XLT
      • XLTHTML
      • XLTM
      • XLTX
    • System File Formats
      • System File Formats
      • AML
      • ASV
      • CAB
      • CFG
      • CPL
      • DLL
      • DMP
      • DRV
      • ETL
      • INI
      • INS
      • LNK
      • SCR
      • SYS
      • TMP
    • Video File Formats
      • Video File Formats
      • 3G2
      • 3GP
      • AMV
      • ARF
      • ASF
      • AVCHD
      • AVI
      • BIK
      • DAV
      • EXO
      • F4V
      • FLV
      • H264
      • H265
      • M2TS
      • M4V
      • MJPEG
      • MK3D
      • MKS
      • MKV
      • MOV
      • MP4
      • MPE
      • MPG
      • MPV
      • MTS
      • MXF
      • NSV
      • QT
      • RM
      • RMVB
      • RV
      • SEC
      • SRT
      • TS
      • VID
      • VOB
      • VP6
      • VP8
      • VP9
      • VTT
      • WEBM
      • WMV
      • XVID
    • Web File Formats
      • Web File Formats
      • A5W
      • AAE
      • ADR
      • AEX
      • ALX
      • AN
      • APKG
      • ARO
      • ASA
      • ASAX
      • ASCX
      • ASHX
      • ASMX
      • ASP
      • ASPX
      • BML
      • CDF
      • CER
      • CFM
      • CFML
      • CHM
      • CODASITE
      • CRDOWNLOAD
      • CRT
      • CSHTML
      • CSS
      • DAP
      • DBM
      • DHTML
      • DML
      • DOCHTML
      • DRAWIO
      • DWT
      • EDGE
      • FMP
      • FWP
      • FWTEMPLATE
      • GDOC
      • GDOCX
      • HAR
      • HDML
      • HTM
      • HTML
      • JHTML
      • JS
      • JSON
      • JSPA
      • LESS
      • MHT
      • MHTML
      • MJS
      • OBML
      • OBML15
      • OBML16
      • P7B
      • P7C
      • PAC
      • PART
      • RHTML
      • RJS
      • RSS
      • Sass
      • SCSS
      • SHTML
      • SPC
      • SSP
      • STC
      • STML
      • TPL
      • TS
      • URL
      • VDW
      • VRT
      • WBS
      • WEBBOOKMARK
      • WEBLOC
      • WEBSITE
      • WHTT
      • WSDL
      • XAML
      • XD
      • XHT
      • XHTML
      • XML
      • XOJ
      • XOML
      • XSLT
      • XUL
      • ZUL
    • Word Processing File Formats
      • Word Processing File Formats
      • ASD
      • DOC
      • DOCM
      • DOCX
      • DOT
      • DOTM
      • DOTX
      • DSC
      • FAQ
      • FODT
      • IPYNB
      • LATEX
      • LTX
      • MAN
      • MD
      • ODM
      • ODT
      • OTT
      • QBL
      • QPF
      • RTF
      • TXT
      • WPD
      • WPS
    • visio
      • Visio File Formats
      • VDW
      • VDX
      • VSD
      • VSDM
      • VSDX
      • VSS
      • VSSM
      • VSSX
      • VST
      • VSTM
      • VSTX
      • VSX
      • VTX
    1. Home
    2. Executable File Formats
    3. WSF

    What's on this Page

      • What is a WSF file?
      • WSF file format
      • Benifits of WSF files
        • Error isolation
        • Mixed language support
        • Exposing constants
      • References

    What is a WSF file?

    A WSF file is a script that fall under the executable category and commonly used in Microsoft Windows. The script supports the mixing of multiple languages, it means that in WSF file may include a blend of JScript, VBScript and optionally some XML elements or other scripting languages such as Python, Object REXX, Perl, Kixtart if installed by the user. The WSF files executes themselves in the absence of WScript or CScript. The WSF files can be beneficial in error isolation and exposing constants.

    WSF file format

    The WSF file format can mix the JScript and VBScript from your previous Windows Script Host projects, a .wsf file allows you to use them with Windows Script Host. A WSF script encapsulates a library of functions that can be used by various WSF files. The example below shows a .wsf file that includes a JScript file (fso.js), plus a VBScript function that calls another function.

    <job id="IncludeExample">
       <script language="JScript" src="FSO.JS"/>
       <script language="VBScript">
          ' Get the free space for drive C.
          s = GetFreeSpace("c:")
          WScript.Echo s
       <script>
    </job>
    

    WSF format supports the following additional features:

    • Include statements
    • Multiple engines
    • Type libraries
    • Tools
    • Multiple jobs in one file

    Benifits of WSF files

    The WSF files can be beneficial in the following areas:

    Error isolation

    The modular nature of WSF file can prevents one script reference from interfering with another which makes the WSF useful for isolating errors. Here is an example of WSF with one module that produces an error and one that does not:

    <?xml version="1.0" ?>
     <job id="Partially works">
       <!-- This will not work -->
       <script language="VBScript">
    '    <![CDATA[
             WScript.echo 4/0 ' Oh, boy! You cannot divide by zero...
         ]]>
       </script>
       <!-- This will work... definitely... -->
       <script language="VBScript">
         <![CDATA[
             WScript.echo "Hello, Scripters!" & vbNewline & _
                          "Fantastic! It worked!"
    '    ]]>
       </script>
     </job>
    

    Mixed language support

    A WSF supports multiple languages, you can have one scripting language use code from another scripting language. Here is an example of how that works:

    <?xml version="1.0" ?>
    <!-- Mixing JScript and VBScript -->
     <job id="SORT-VBScriptWithJScript">
       <script language="JScript">
         function SortVBArray(arrVBArray) {return arrVBArray.toArray().sort();}
       </script>
       <script language="VBScript">
    '    <![CDATA[
         '** Fastest sort: call the Jscript sort from VBScript
         myData = "a,b,c,1,2,3,X,Y,Z,p,d,q"
         wscript.echo "Original List of values: " & vbTab & myData
         starttime = timer()
         sortedArray = SortVBArray(split(myData,","))
         endtime=timer()
         jscriptTime = round(endtime-starttime,2)
         wscript.echo "JScript sorted in " & jscriptTime & " seconds: "  & vbTab & sortedArray
    '    ]]>
       </script>
     </job>
    

    Exposing constants

    The WSF support the binding of an XML wrapper to an object reference or control so you can use that object’s constants instead of having to declare them. Following is an example:

    <?xml version="1.0" ?>
    <!-- WSF Example with Object Reference
    Notes for this very formal example:
     CDATA is used to help the XML parser ignore 
     special characters in the content of the script.  
     The CDATA open and close must be masked 
     from VBScript by making them comments.
    -->
    <package>
     <job id="EnumerateConstantsADO">
      <reference object="ADODB.Recordset" />
      <script language="VBScript">
    '  <![CDATA[
        dim title, str, i
        ctecArray = Array("adOpenUnspecified","adOpenForwardOnly", _
                          "adOpenKeyset","adOpenDynamic","adOpenStatic")
        title = "ADO Recordset Values for Constants"
        str = title & vbNewLine & vbNewLine
        str = str & "*CursorTypeEnum Constants*" & vbNewLine
        For i = 0 to ubound(ctecArray)
          str = str & Eval(ctecArray(i)) & vbTab & ctecArray(i) & vbNewLine
        Next
        str = str & vbNewLine
        str = str & "*LockTypeEnum Constants*" & vbNewLine
        ltecArray = Array("adLockUnspecified","adLockReadOnly", _
                          "adLockPessimistic","adLockOptimistic", _
                          "adLockBatchOptimistic")
        For i = 0 to ubound(ltecArray)
          str = str & Eval(ltecArray(i)) & vbTab & ltecArray(i) & vbNewLine
        Next
        MsgBox str, vbInformation, Title
    '  ]]>
      </script>
     </job>
    </package>
    

    References

    • Windows Installer - by Wikipedia

    See Also

    • AVIF File Format
    • RA File Format
    • KT File Format
    • RM File Format
    • RV File Format