Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Windows Script Host
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==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''.<ref name=whatis>{{cite web|url=http://msdn.microsoft.com/en-us/library/shzd7dy4(VS.85).aspx|title=What Is WSH?|website=msdn.microsoft.com|date=24 October 2011 |access-date=30 April 2018|url-status=live|archive-url=https://web.archive.org/web/20180107031236/https://msdn.microsoft.com/en-us/library/shzd7dy4(VS.85).aspx|archive-date=7 January 2018}}</ref> 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.<ref name=whatis/> These scripts may be run in [[GUI]] mode (''WScript''.exe) or command line mode (''CScript''.exe), or from a COM object (''wshom''.ocx), offering flexibility to the user for interactive or non-interactive scripts.<ref>{{cite web|url=http://msdn.microsoft.com/en-us/library/ec0wcxh3(VS.85).aspx|title=Windows Script Host Basics|website=msdn.microsoft.com|date=24 October 2011 |access-date=30 April 2018|url-status=live|archive-url=https://web.archive.org/web/20170808154157/https://msdn.microsoft.com/en-us/library/ec0wcxh3(VS.85).aspx|archive-date=8 August 2017}}</ref> [[Windows Management Instrumentation]] is also scriptable by this means. WSH, the engines, and related functionality are also listed as objects which can be accessed and scripted and queried by means of the [[Visual Basic for Applications|VBA]] and Visual Studio object explorers and those for similar tools like the various script debuggers, e.g. [[Microsoft Script Debugger]], and editors. WSH implements an [[object model]] which exposes a set of [[Component Object Model]] (COM) interfaces.<ref>{{cite web|url=http://msdn.microsoft.com/en-us/library/a74hyyw0(VS.85).aspx|title=Windows Script Host Object Model|website=msdn.microsoft.com|date=24 October 2011 |access-date=30 April 2018|url-status=live|archive-url=https://web.archive.org/web/20170808153910/https://msdn.microsoft.com/en-us/library/a74hyyw0(VS.85).aspx|archive-date=8 August 2017}}</ref> So in addition to ASP, IIS, Internet Explorer, CScript and WScript, 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]] by various means including various [[ODBC]] engines and [[SQL]], ooRexxScript to create what are in effect Rexx macros in [[Microsoft 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, and so on. The [[Visual Basic for Applications|VBA]] functionality of Microsoft Office, [[Apache OpenOffice|Open Office]] (as well as [[Python (programming language)|Python]] and other installable macro languages) and [[Corel WordPerfect Office]] is separate from WSH engines although [[Microsoft Outlook|Outlook 97]] uses [[VBScript]] rather than VBA as its macro language.<ref>MSDN "VBA"</ref> [[Python (programming language)|Python]] in the form of [[ActiveState]] [[PythonScript]] can be used to automate and query the data in [[SecureCRT]], as with other languages with installed engines, e.g. [[PerlScript]], [[ooRexxScript]], [[PHPScript]], [[RubyScript]], [[LuaScript]], [[XLNT]] and so on. One notable exception is [[Paint Shop Pro]], which can be automated in Python by means of a macro interpreter within the PSP programme itself rather than using the PythonScript WSH engine or an external Python implementation such as Python interpreters supplied with [[Unix]] emulation and integration software suites or other standalone Python implementations et al.<ref>User's Manual, Paint Shop Pro 8</ref><ref>Paint Shop Pro 8 help, "Automation"</ref> as an intermediate and indeed can be programmed like this even in the absence of any third-party Python installation; the same goes for the Rexx-programmable terminal emulator Passport.<ref>main help file, Passport for Windows</ref> The [[SecureCRT]] terminal emulator, [[SecureFX]] FTP client, and related client and server programmes from Van Dyke are as of the current versions automated by means of WSH so any language with an installed engine may be used; the software comes with VBScript, JScript, and PerlScript examples. As of the most recent releases and going back a number of versions now, the programmability of [[Take Command Console|4NT / Take Command]] in the latest implementations (by means of "@REXX" and similar for Perl, Python, Tcl, Ruby, Lua, VBScript, JScript, and the like) generally uses the WSH engine.<ref>Take Command documentation 18.00 documentation hard copy and Help file</ref> The [[ZOC (software)|ZOC]] terminal emulator gets its ability to be programmed in Rexx by means of an external interpreter, one of which is supplied with the programme, and alternate Rexx interpreters can be specified in the configuration of the programme.<ref>Zoc v 6.0 help</ref><ref>Zoc 5.0 printed manual</ref> The MKS Toolkit provides PScript, a WSH engine in addition to the standard Perl interpreter perl.exe which comes with the package. VBScript, JScript, and some third-party engines have the ability to create and execute scripts in an encoded format which prevents editing with a text editor; the file extensions for these encoded scripts is {{Not a typo|.vbe}} and {{Not a typo|.jse}} and others of that type. 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,<ref>MSDN documentation</ref> 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 to software being developed and can be found in earlier versions of [[Host Explorer]] for example. 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.<ref>Windows Office 97 & 2000 Bibles (Wiley)</ref> One exception is that the [[ZOC (software)|Zoc]] terminal emulator is controlled by a [[Rexx]] interpreter supplied with the package or another interpreter specified by the user; this is also the case with the Passport emulator. 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]]. [[Apache OpenOffice|OpenOffice]] uses Visual Basic, Python, and several others as macro languages and others can be added. [[LotusScript]] is very closely related to VBA and used for [[Lotus Notes]] and [[Lotus SmartSuite]], which includes [[Lotus Word Pro]] (the current descendant of [[Ami Pro]]), [[Lotus Approach]], [[Lotus FastSite]], [[Lotus 1-2-3]], &c, and pure VBA, licensed from Microsoft, is used in Corel products such as [[WordPerfect]], [[Paradox (database)|Paradox]], [[Quattro Pro]] &c. Any scripting language installed under 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 Database]], Paradox) and spreadsheets (Microsoft Excel, Lotus 1-2-3, Quattro Pro) and other tools like word processors, terminal emulators, command shells and so on. This can be accomplished by means of WSH, so any language can be used if there is an installed engine. In recent versions of the [[Take Command Console|Take Command]] enhanced command prompt and tools, the "script" command typed at the shell prompt will produce a list of the currently installed engines, one to a line and therefore CR-LF delimited.<ref>Take Command version 18.00 documentation</ref><ref>JP Software Take Command-4NT-4Dos-4OS/2 site, bulletin board</ref><ref>Take Command 18.00 help</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)