Windows Script Host
The Microsoft Windows Script Host (WSH) is an automation technology for Microsoft Windows operating systems that provides scripting abilities comparable to batch files, but with a wider range of supported features. It was originally called Windows Scripting Host, but was renamed for the second release.
It is language-independent in that it can make use of different Active Scripting language engines. By default, it interprets and runs plain-text JScript (.JS and .JSE files) and VBScript (.VBS and .VBE files).
Users can install different scripting engines to enable them to script in other languages, for instance PerlScript. The language independent filename extension WSF can also be used. The advantage of the Windows Script File (.WSF) is that it allows the user to use a combination of scripting languages within a single file.
Windows Script Host is distributed and installed by default on Windows 98 and later versions of Windows. It is also installed if Internet Explorer 5 (or a later version) is installed. Beginning with Windows 2000, the Windows Script Host became available for use with user login scripts.
Windows Script Host may be used for a variety of purposes, including logon scripts, administration and general automation. Microsoft describes it as an administration tool. WSH provides an environment for scripts to run – it invokes the appropriate script engine and provides a set of services and objects for the script to work with. These scripts may be run in either GUI mode (WScript.exe) or command line mode (CScript.exe) offering flexibility to the user for interactive or non-interactive scripts. WSH implements an object model which exposes a set of Component Object Model (COM) interfaces. So in addition to ASP, IIS, Internet Explorer, CScript and WScript, the WSH can be used to automate and communicate with any Windows application with COM and other exposed objects, such as using PerlScript to query Microsoft Access, ooRexxScript to create what are in fact Rexx macros in Excel, Quattro Pro, Microsoft Word, Lotus Notes and any of the like, the XLNT script to get environment variables and print them in a new TextPad document, Python can be used to automate and query the data in SecureCRT . . .
Unless otherwise specified, any WSH scripting engine can be used with the various Windows server software packages to provide CGI scripting. The current versions of the default WSH engines and all or most of the third party engines have socket abilities as well; as a CGI script or otherwise, PerlScript is the choice of many programmers for this purpose and the VBScript and various Rexx-based engines are also rated as sufficiently powerful in connectivity and text-processing abilities to also be useful. This also goes for file access and processing—the earliest WSH engines for VBScript and JScript do not since the base language did not, whilst PerlScript, ooRexxScript, and the others have this from the beginning.
WinWrap Basic, SaxBasic and others are similar to Visual Basic for Applications, These tools are used to add scripting and macro abilities. Many other languages can also be used in this fashion. Other languages used for scripting of programmes include Rexx, Tcl, Perl, Python, Ruby, and others which come with methods to control objects in the operating system and the spreadsheet and database programmes.
VBScript is the macro language in Microsoft Outlook 97, whilst WordBasic is used for Word up to 6, Powerpoint and other tools. Excel to 5.0 uses Visual Basic 5.0. In Office 2000 forward, true Visual Basic for Applications 6.0 is used for all components. Other components use Visual Basic for Applications. OpenOffice uses Visual Basic, Python, and several others as macro languages and others can be added. LotusScript is very closely related to VBA, and pure VBA licensed from Microsoft is used Corel products such as Lotus Notes, Lotus 1·2·3, Quattro Pro &c.
Any scripting language connected to the Windows can be accessed by external means of PerlScript, PythonScript, VBScript and the other engines available can be used to access databases (Lotus Notes, Microsoft Access, Oracle), spreadsheets (Microsoft Excel Lotus 1·2·3, Quattro Pro. This can be accomplished by means of the WSH so any language can be used if there is an installed engine.
The first example is very simple; it shows some VBScript which uses the root WSH COM object "WScript" to display a message with an 'OK' button. Upon launching this script the CScript or WScript engine would be called and the runtime environment provided.
Content of a file
WScript.Echo "Hello world" WScript.Quit
WSH programming can also use the JScript language.
Content of a file
WSH.Echo("Hello world"); WSH.Quit();
Content of a file
<job> <script language="VBScript"> MsgBox "hello world (from vb)" </script> <script language="JScript"> WSH.echo("hello world (from js)"); </script> </job>
Windows applications and processes may be automated using a script in Windows Script Host. Viruses and malware could be written to exploit this ability. Thus, some suggest disabling it for security reasons. Alternatively, antivirus programs may offer features to control .vbs and other scripts which run in the WSH environment.
Since version 5.6 of WSH, scripts can be digitally signed programmatically using the Scripting.Signer object in a script itself, provided a valid certificate is present on the system. Alternatively, the signcode tool from the Platform SDK, which has been extended to support WSH filetypes, may be used at the command line.
By using Software Restriction Policies introduced with Windows XP, a system may be configured to execute only those scripts which have been digitally signed, thus preventing the execution of untrusted scripts.
Available scripting engines
|Name||Language||File extensions||Availability||Produced By||Status||Date||Notes|
|VBScript||Microsoft VBScript||.vbs||Installed by default||Microsoft||default install||1999|
|JScript||Microsoft JScript||.js||Installed by default||Microsoft||default install||1999|
|VBA||Microsoft Visual Basic for Applications||.mod, .bas, .frm, other||Installed by default||Microsoft||default install||1999|
|JScript .NET WSH Engine||Microsoft JScript||.js*||.NET Framework Component||Microsoft||With various tools, .NET Framework||2003||May require manual install/config|
|VB.NET WSH Engine||Microsoft VB.NET||.vb*||.NET Framework Component||Microsoft||With various tools, .NET Framework||2003||May require manual install/config|
|WinWrap Basic||WinWrap Basic||.wwb||In the main WWB installation||Polar Engineering||Standard functionality of WWB||2004|
|PerlScript||Perl||.pls||with ActiveState Perl||ActiveState||Open source||1999|
|PScript||Perl||.p||with MKS Toolkit||MKS||Commercial||2001|
|LotusScript WSH||LotusScript||.nsf||Third party download||Service Desk Plus||Freeware||2001|
|RexxScript||Rexx||.rxs, .rx, .rex||With some Rexx implementations||Various||Freeware||1998|
|ooRexxScript||REXX||.rxs||with Open Object Rexx||Open Object Rexx team||Open source|
|PythonScript||Python||.pys||SourceForge & with ActivePython||The Pywin32 project||Open source|
|TclScript||Tcl/Tk||.tcls||SourceForge||ActiveState or third party||Open source|
|ActivePHPScript||PHP||.phps||with PHP||PHP team||Open source|
|PHPScript||PHP||.phps||with PHP||PHP team||Open source||Earlier version of ActivePHPScript|
|RubyScript||Ruby||.rbs||with Ruby||Ruby team||Open source|
|XLNTScript||XLNT||.xcs||with XLNT||ASCI||Commercial||1997||A DCL-based multi-purpose scripting application for Windows|
|LuaScript||Lua||.lua||with Lua||Lua organisation||Open Source|
|Object REXX engine||Object REXX||.rex, .rxs||with IBM Object REXX||IBM||Commercial||2002|
|XML Engine||XML parsing||.xml||with many XML implementations||Elf Data||de facto Default install||2000||Macintosh too|
|Kixtart WSH Engine||Kixtart||.kix||with KixStart||Microsoft Netherlands||Windows Resource Kits and other resources||1996||Download from Microsoft or elsewhere, aka KixStart32|
|NullScript||NullScript||.ns||with NullScript||NullScript Organisation||Windows Resource Kits and other resources||1998|
|HaskellScript||Haskell||free download||Open Source|
|XSLT WSH Engine||XSLT||free download||Open Source|
|CobolScript WSH Engine||Cobol||Proprietary|
|Delphi scripting engine||Delphi||In some Delphi distributions or resource kits||Commercial||2003|
|DMDScript||D||Available on Web||Freeware||2014|
|C# Script||C#||Source code available||Open Source, active development underway||2013|
|Small C Scripting Engine||C||Various locations, check Web||Freeware||2009|
|Take Command WSH Engine||4NT/Take Command||Check JP Software||JP Software||Proprietary||2015||Early development|
|92Script WSH Engine||TI-89/92+/Voyager 200 TI-Basic||.92bs||Project Web/FTP site||Various independent programmers||Experimental, Open Source||2014||Beta Q4 2015 for main engine; graphing functionality (92Script/Tk) then or later|
|48Script WSH Engine||HP-48 Calculator family on-board programming language||.48s||Project Web/FTP site||Various independent programmers||Experimental||2015||Status as of 30.IX.2015. Language has Lisp, Basic, Forth, and other influences.|
|Fortran Script||Fortran||Various||Various||Experimental proof-of-concept, academic exercise, shareware, commercial, open source.||2000|
|PascalScript||Object Pascal||Object Pascal||RemObjects||Freeware||2001||Can also be used with Delphi directly|
|Lisp WSH Engine||Lisp||Lisp implementaton||AutoLisp and others||Freeware or Shareware|
|ECMAScript WSH engines||ECMAScript||Various||Various||Experimental, Freeware, Open Source, Shareware, Proprietary, Commercialware||2005||There are numerous ECMAScript implementations but not all have WSH engines|
|CFXScript WSH Engine||Casio CFX-9850 and fx Calculator series on-board programming language||.cfxb||Project Web/FTP Sites||independent programmers||Experimental||2015||Status as of 30.IX.2015. Language has elements of Basic, Forth, Fortran, and others.|
|SharpCalcScript WSH Engine||Sharp graphing calculators on-board programming language||.scsb||Project Web/FTP Sites||independent programmers||Experimental||2015||Status as of 30.IX.2015. Also subsumes the S-Basic language of Sharp's Pocket Computers.|
In addition to those listed above, an engine for the Take Command/4NT scripting language is in the development phase. The language is an extended analogue of the cmd.exe command shell found in the Windows NT-2000-XP et seq; 4NT, the pure console version, is now named Take Command Console (TCC) Take Command, a GUI-based IDE for the language, and TCC and Take Command are now at version 18.0 The 4NT/TC language also has functions built in to work with numerous scripting languages.
There have been suggestions of creating engines for other languages, such as LotusScript, SaxBasic, BasicScript, KiXtart, awk, bash, csh and other Unix shells, 4NT, cmd.exe (the Windows NT shell), Windows PowerShell, DCL, C, C++, Fortran and others. The XLNT language is based on DCL and provides a very large subset of the language along with additional commands and statements and the software can be used in three ways: the WSH engine (*.xcs), the console interpreter (*.xlnt) and as a server and client side CGI engine (*.xgi).
When a server implementing CGI such as the Windows Internet Information Server, ports of Apache and others, all or most of the engines can be used; the most commonly used are VBScript, JScript, PythonScript, PerlScript, ActivePHPScript, and ooRexxScript. The MKS Toolkit PScript programme also runs Perl. Command shells like cmd.exe, 4NT, ksh, and scripting languages with string processing and preferably socket functionality are also able to be used for CGI scripting; compiled languages like C++, Visual Basic, and Java can also be used like this. All Perl interpreters, ooRexx, PHP, and more recent versions of VBScript and JScript can use sockets for TCP/IP and usually UDP and other protocols for this.
|Windows version||Shipped with WSH version||Last redistributable version|
|Windows 95||None (separate redistributable)||5.6|
|Windows NT 4.0||None (separate redistributable)||5.6|
|Windows 2000||2.0 (also termed WSH 5.1)||5.7|
|Windows Me||2.0 (also termed WSH 5.1)||5.6|
|Windows 2000 SP3 and SP4 Windows XP, Windows Server 2003||5.6||5.7|
|Windows Vista, Windows Server 2008, Windows XP SP3||5.7||Not applicable|
|Windows 7, Windows Server 2008 R2||5.8||Not applicable|
|Windows 8, Windows Server 2012||5.8||Not applicable|
|Windows 10, Windows Server 2016||5.812||Not applicable|
The redistributable version of WSH version 5.6 can be installed on Windows 95/98/Me and Windows NT 4.0/2000. WSH 5.7 is downloadable for Windows 2000, Windows XP and Windows Server 2003. Recently[when?], redistributable versions for older operating systems (Windows 9x and Windows NT 4.0) are no longer available from the Microsoft Download Center.
Since Windows XP Service Pack 3, release 5.7 is not needed as it is included, with newer revisions being included in newer versions of Windows since.
- What is WSH?
- Windows Script Host Basics
- Windows Script Host Object Model
- MSDN documentation
- Windows Office 97 & 2000 Bibles (Wiley)
- Windows Script Host – disabling
- In-depth discussion of the security features in WSH 5.6
- Windows Script Host 5.6 Boasts Windows XP Integration, Security, New Object Model
- TCC/Take Command comprehensive documentation for V 18.0 (PDF)
- ASCI html help file
- ASCI site