Windows Script Host


Windows Script Host
The Icon For Windows Script Host

The Microsoft Windows Script Host (WSH) is an automation technology for Microsoft Windows operating systems that provides scripting capabilities comparable to batch files, but with a greater range of supported features. It was originally called Windows Scripting Host, but was renamed for the second release.

It is language-independent in the sense 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.

WSH engines include various implementations for the Rexx, Basic, Perl, Ruby, Tcl, PHP, JavaScript, Delphi, Python, XSLT, and other languages.

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.

Contents

Usage

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.[1] 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.[1] 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.[2] WSH implements an object model which exposes a set of COM interfaces.[3]

Examples

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 hello0.vbs

WScript.Echo "Hello world"
WScript.Quit

For WSH programing you can also use the JScript language.

Content of a file hello1.js

WSH.Echo("Hello world");
WSH.Quit();

Or you can mix VBScript and JScript (and any other) code in the same WSF file:

Content of a file hello2.wsf

<job>
<script language="VBScript">
  MsgBox "hello world (from vb)"
</script>
<script language="JScript">
  WSH.echo("hello world (from js)");
</script>
</job>

Security concerns

Windows applications and processes may be automated using a script in Windows Script Host. Viruses and malware could be written to exploit this ability. Consequently, some suggest disabling it for security reasons.[4] Alternatively antivirus programs may offer features to control .vbs and other scripts which run in the WSH environment.

One way to address security concerns about Windows Script Host is to change the default handler for the .vbs, .vbe, .js, .jse, .wsf, .wsh file types to edit rather than run.[5]

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.[6]

Available scripting engines

Name Language File Extensions Availability Produced By Status Date Notes
VBScript Microsoft Visual Basic, Scripting Edition .vbs Installed by Default Microsoft default install 1999
JScript Microsoft JScript .js Installed by Default Microsoft default install 1999
PerlScript Perl .pls Available with ActiveState Perl ActiveState Freeware 1999
ooRexxScript Rexx .rxs Available with Open Object Rexx Open Object Rexx team Freeware
PythonScript Python .pys SourceForge The Pywin32 project Freeware
TclScript Tcl/Tk .tcls SourceForge ActiveState and/or third party Freeware
ActivePHPScript PHP .phps Available with PHP PHP team Freeware
RubyScript Ruby .rbs Available with Ruby Ruby team Freeware
Object Rexx engine Rexx Available with IBM ObjectRexx IBM Commercial 2002
Delphi scripting engine Delphi In some Delphi distributions or resource kits Commercial 2003

Version history

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 98 1.0 5.6
Windows 2000 2.0 (also known as WSH 5.1) 5.7
Windows Me 2.0 (also known as WSH 5.1) 5.6
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

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, redistributable versions for older operating systems (Windows 9x and Windows NT 4.0) are no longer available from the Microsoft Download Center.

As of Windows XP Service Pack 3, release 5.7 is not necessary as it is included.

See also

References

External links


Wikimedia Foundation. 2010.

Look at other dictionaries:

  • Windows Script Host — (WSH; первоначально назывался Windows Scripting Host, был переименован ко второму выпуску)  компонент Microsoft Windows, предназначенный для запуска сценариев на скриптовых языках JScript и VBScript, а также и на других дополнительно… …   Википедия

  • Windows Script Host — es un motor y entorno de ejecución de scripts para sistemas Windows que posee funcionalidad comparable a la de los archivos de procesamiento por lotes (archivos batch), pero supera a éstos en cuanto a la variedad y capacidad de los lenguajes que… …   Wikipedia Español

  • Windows Script Host — Der Windows Script Host (WSH) (früher: Windows Scripting Host) ist in Windows Betriebssystemen eine COM basierte Laufzeitumgebung für Skriptsprachen. Der WSH lässt sich seit Windows 95 und Windows NT 4.0 verwenden, seit Windows 98 SE und Windows… …   Deutsch Wikipedia

  • Windows Scripting Host — Windows Script Host, aussi abrégé en l acronyme WSH, désigne un logiciel permettant d exécuter des scripts, inclus dans les systèmes d exploitation Windows. Concrètement, il se présente sous la forme de trois programmes hôtes : wscript.exe… …   Wikipédia en Français

  • Windows Scripting Host — Der Windows Script Host (WSH) (früher: Windows Scripting Host) ist in Windows Betriebssystemen eine COM basierte Laufzeitumgebung für Skriptsprachen. Der WSH lässt sich seit Windows 95 und Windows NT 4.0 verwenden, seit Windows 98 SE und Windows… …   Deutsch Wikipedia

  • Windows Scripting Host —   [Abk. WSH], der von Microsoft entwickelte Scripting Host für Windows Betriebssysteme, d. h. eine Programmierumgebung, mit der sich auf Windows Systemen (Windows 98/Me, NT/2000 sowie Windows XP) Scripts ausführen lassen. Der WSH dient dazu,… …   Universal-Lexikon

  • Windows Script File — Infobox file format name = Windows Script File extension = .wsf owner = Microsoft genre = Scripting container for = ScriptsA Windows Script File (WSF) is a file type used by the Microsoft Windows Script Host. It allows mixing scripting languages… …   Wikipedia

  • Windows PowerShell — Screenshot of a sample PowerShell session …   Wikipedia

  • Windows PowerShell — Windows PowerShell …   Википедия

  • Windows Powershell — Windows PowerShell, anciennement Microsoft Command Shell MSH , (nom de code Monad) est une interface en ligne de commande et un langage de script développé par Microsoft. Il est basé sur la programmation orientée objet et le framework Microsoft… …   Wikipédia en Français


Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”

We are using cookies for the best presentation of our site. Continuing to use this site, you agree with this.