Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Windows Script Host

From Wikipedia, the free encyclopedia
Automation technology for Windows
Windows Script Host (WSH)
Other namesWindows Scripting Host
DeveloperMicrosoft
Stable release
5.812
Operating systemMicrosoft Windows
TypeAutomation technology
LicenseProprietarycommercial software
WebsiteWindows Script Host overview

TheMicrosoftWindows Script Host (WSH) (formerly namedWindows Scripting Host) is an automation technology forMicrosoft Windowsoperating systems that provides scripting abilities comparable tobatch files, but with a wider range of supported features. This tool was first provided on Windows 95 after Build 950a on the installation discs as an optional installation configurable and installable by means of theControl Panel, and then a standard component of Windows 98 (Build 1111) and subsequent and Windows NT 4.0 Build 1381 and by means of Service Pack 4. WSH is also a means of automation forInternet Explorer via the installed WSH engines from IE Version 3.0 onwards; at this, time VBScript became a means of automation forMicrosoft Outlook 97.[1] WSH is also an optional install provided with a VBScript and JScript engine forWindows CE 3.0 and following; some third-party engines, includingRexx and other forms ofBASIC, are also available.[2][3][4]

It is language-independent in that it can make use of differentActive Scripting language engines. By default, it interprets and runs plain-textJScript (.JS and .JSE files) andVBScript (.VBS and .VBE files).

Users can install differentscripting engines to enable them to script in other languages, for instancePerlScript. The language-independentfilename extension WSF can also be used. The advantage of theWindows Script File (.WSF) is that it allows multiple scripts ("jobs") as well as a combination of scripting languages within a single file.

WSH engines include various implementations for theRexx,ooRexx (up to version 4.0.0),BASIC,Perl,Ruby,Tcl,PHP,JavaScript,Delphi,Python,XSLT, and other languages.

Windows Script Host is distributed and installed by default onWindows 98 and later versions of Windows. It is also installed ifInternet Explorer 5 (or a later version) is installed. Beginning withWindows 2000, the Windows Script Host became available for use with user login scripts.

Usage

[edit]

Windows Script Host may be used for a variety of purposes, including logon scripts, administration and general automation. Microsoft describes it as anadministration tool.[5] 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.[5] These scripts may be run inGUI 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.[6]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 theVBA and Visual Studio object explorers and those for similar tools like the various script debuggers, e.g.Microsoft Script Debugger, and editors.

WSH implements anobject model which exposes a set ofComponent Object Model (COM) interfaces.[7] 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 queryMicrosoft Access by various means including variousODBC engines andSQL, ooRexxScript to create what are in effect Rexx macros inMicrosoft Excel, Quattro Pro,Microsoft Word,Lotus Notes and any of the like, theXLNT script to get environment variables and print them in a newTextPad document, and so on.

TheVBA functionality of Microsoft Office,Open Office (as well asPython and other installable macro languages) andCorel WordPerfect Office is separate from WSH engines althoughOutlook 97 usesVBScript rather than VBA as its macro language.[8]

Python in the form ofActiveStatePythonScript can be used to automate and query the data inSecureCRT, as with other languages with installed engines, e.g.PerlScript,ooRexxScript,PHPScript,RubyScript,LuaScript,XLNT and so on. One notable exception isPaint 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 withUnix emulation and integration software suites or other standalone Python implementations et al.[9][10] 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.[11] TheSecureCRT 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 of4NT / 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.[12] TheZOC 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.[13][14] 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 .vbe and .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,[15] 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 ofHost 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.[16] One exception is that theZoc terminal emulator is controlled by aRexx 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 inMicrosoft Outlook 97, whilstWordBasic 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 useVisual 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 used forLotus Notes andLotus SmartSuite, which includesLotus Word Pro (the current descendant ofAmi Pro),Lotus Approach,Lotus FastSite,Lotus 1-2-3, &c, and pure VBA, licensed from Microsoft, is used in Corel products such asWordPerfect,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 theTake 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.[17][18][19]

Examples

[edit]

The first example is very simple; it shows someVBScript 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 filehello0.vbs

WScript.Echo"Hello world"WScript.Quit

WSH programming can also use theJScript language.

Content of a filehello1.js

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

Or, code can be mixed in oneWSF file, such asVBScript andJScript, or any other:

Content of a filehello2.wsf

<job><scriptlanguage="VBScript">MsgBox"helloworld(fromvb)"</script><scriptlanguage="JScript">WScript.Echo("helloworld(fromjs)");</script></job>

Security concerns

[edit]

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.[20] 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 bedigitally signed programmatically using theScripting.Signer object in a script itself, provided a validcertificate 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.[21]

By usingSoftware Restriction Policies introduced with Windows XP, a system may be configured to execute only those scripts which are stored in trusted locations, have a known MD5 hash, or have been digitally signed by a trusted publisher, thus preventing the execution of untrusted scripts.[22]

Available scripting engines

[edit]

Note: By definition, all of these scripting engines can be utilised inCGI programming under Windows with any number of programmes and set up, meaning that the source code files for a script used on a server for CGI purposes could bear other file extensions such as .cgi and so on. The aforementioned ability of the Windows Script Host to run a script with multiple languages in it in files with a .wsh extension.Extended Html andXML also add to the additional possibilities when working with scripts for network use, as doActive Server Pages and so forth. Moreover, Windowsshell scripts and scripts written in shells with enhanced capabilities likeTCC,4NT, etc. and Unix shells under interoperability software like theMKS Toolkit can have scripts embedded in them as well.

Engine nameScripting language implementedBase languageFile extensionsAvailabilityProduced byStatusInitial release dateEncoded scriptsNotes
VBScriptMicrosoftVBScriptMicrosoftVisual Basic.vbsInstalled by defaultMicrosoftdefault install1999Yes, .vbeDefault windows host script
JScriptMicrosoftJScriptECMAScript.jsInstalled by defaultMicrosoftdefault install1999Yes, .jseDefault java script host
WinWrap BasicWinWrap BasicBasic.wwbIn the main WWB installationPolar EngineeringStandard functionality of WWB; Utilises both .NET and COM2004Yes
PerlScriptPerlPerl 5.plswith ActiveState PerlActiveStateOpen source1999Reportedly yes
PScriptPerlPerl 5, CGI functionality.p, .pswith MKS ToolkitMKSCommercial2001
XBScriptxBase Scripting EnginexBase (Clipper).xbs, .prgClipperwith XBScript softwareCommercial
LotusScript WSHLotusScriptMicrosoft Visual Basic (q.v.).nsfThird party downloadService Desk PlusFreeware2001
RexxScriptRexxRexx.rxs, .rx, .rexWith some Rexx implementationsVariousFreeware1998
ooRexxScriptOpen Object REXXREXX.rxswith Open Object Rexx or free from some third partiesOpen Object Rexx teamOpen source
PythonScriptPythonPython.pysSourceForge & with ActivePythonThe Pywin32 projectOpen source
TclScriptTcl/TkTcl/Tk.tclsSourceForgeActiveState or third partyOpen source
ActivePHPScriptPHPPHP.phpswith PHPPHP teamOpen source
PHPScriptPHPPHP.phpswith PHPPHP teamOpen sourceEarlier version of ActivePHPScript
RubyScriptRubyRuby.rbswith Ruby distributionRuby teamOpen sourceYes
XLNTScriptXLNTDCL.xcswith XLNTAdvanced Systems Concepts, Inc.Commercial1997AnOpenVMSDCL-based multi-purpose scripting application for Windows
LuaScriptLuaLua.luawith LuaLua organisationOpen source
Object REXX engineObject REXXRexx.rex, .rxswith IBM Object REXXIBMCommercial2002
XML EngineXML parsingExtended HTML, XML.xmlwith many XML implementationsElf Datade facto Default install2000Macintosh too
Kixtart WSH EngineKixtartKixTart, MS-DOS, Windows 95. Windows NT shells.kixwith KixStartMicrosoft NetherlandsWindows Resource Kits and other resources1996Download from Microsoft or elsewhere, aka KixStart32
NullScriptNullScriptNull language.nswith NullScriptNullScript OrganisationWindows Resource Kits and other resources1999
ForthScriptForthForth.fth, othersForthDMOZOpen source
Haskell ScriptHaskellHaskell*.hsk (provisional), othersfree downloadOpen source
XSLT WSH EngineXSLTXSLT.xsltfree downloadOpen source
CobolScript WSH EngineCobolCobol.cbl. .cob, .cbFujitsu Cobol 3 — free for educational useCommercialware from Fujitsu free with free compiler for educators &cProprietary
Delphi scripting engineDelphiDelphi, a Pascal variant.dlp, .del, .In some Delphi distributions or resource kitsCommercial2003
DMDScriptDMDScriptD, a major incrementation of C.dmdDMD Distributions, downloadFreeware: Available on Web2014DMD
C# ScriptC#Microsoft C#.NET.cs. .c#, othersSource code available?Open source2013
Small C Scripting EngineCC (K&R, Ansi).c, othersVarious locations, check WebFreeware2009
JavaScript WSH EngineJavaScript/JavaJava & variants.java, .j, jva, othersWith many JavaScript implementationsSun/Other Java OrganisationsFreeware
Take Command WSH Engine4NT/Take CommandTCC, the current version of4NT p.btm, .cmd, bat, othersCheck JP SoftwareJP SoftwareProprietary2015Early development
92Script WSH EngineTI-89/92+/Voyager 200TI-BasicCalculator TI-Basic.92bsProject Web/FTP siteVarious independent programmersExperimental, Open Source2014"possible"Beta Q4 2015 for main engine; graphing functionality (92Script/Tk) then or later
48Script WSH EngineHP-48 Calculator family on-board programming languageHP 48 Programming Language, distant relative of Forth, Basic, Lisp.48sProject Web/FTP siteVarious independent programmersExperimental2015PlannedStatus as of 2015-09-30. Language has Lisp, Basic, Forth, and other influences.
Fortran ScriptFortranFortran 77.for, .ftn. f77, f90, f95VariousVariousExperimental proof-of-concept, academic exercise, shareware, commercial, open source.2000
PascalScriptObject PascalPascal 7.pas, .ops, otherObject PascalRemObjectsFreeware2001Can also be used with Delphi directly
Lisp WSH EngineLispLisp.lisp, .lspVarious Lisp toolsAutoLisp and othersFreeware or Shareware
BESENECMA-JavaScriptJava and Variants.bes, .bsn, othersSourceForgeBESEN OrganisationOpen source2011
ECMAScript WSH enginesJava and VariantsVariousVariousVariousVariousExperimental, Freeware, Open Source, Shareware, Proprietary, Commercialware2005There are numerous ECMAScript implementations but not all have WSH engines
CFXScript WSH EngineCasio CFX-9850 and fx Calculator series on-board programming languageCasio Calculator Programming Language, as ported to various operating systems as CFW.cfxbProject Web/FTP Sitesindependent programmersExperimental2015Planned[23]Status as of 2015-09-30. Language has elements of Basic, Forth, Fortran, and others.
SharpCalcScript WSH EngineSharp graphing calculators on-board programming languageSharp S-Basic as ported to windows as NeusSFortran.scsbProject Web/FTP Sitesindependent programmersExperimental2015PlannedStatus as of 2015-09-30. Also subsumes the S-Basic language of Sharp's Pocket Computers.

There have been suggestions of creating engines for other languages, such asLotusScript,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.[24]The XLNT language[25] 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).[26]

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 program 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.

Version history

[edit]
Windows versionShipped with WSH versionLast redistributable version
Windows 95None (separate redistributable)5.6
Windows NT 4.0None (separate redistributable)5.6
Windows CE 3.01.0 (optional install on installer disc)2.0
Windows 981.05.6
Windows 98 Second Edition1.05.6
Windows 20002.0 (also termed WSH 5.1)5.7
Windows 2000 SP3, SP4 and SP55.65.7
Windows Me2.0 (also termed WSH 5.1)5.6
Windows XP5.65.7
Windows XP SP35.7Not applicable
Windows Server 20035.65.7
Windows Vista5.7Not applicable
Windows Server 20085.7Not applicable
Windows 75.8Not applicable
Windows Server 2008 R25.8Not applicable
Windows 85.8Not applicable
Windows Server 20125.8Not applicable
Windows 105.812Not applicable
Windows Server 20165.812Not 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. On or after[when?] 2006, 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 the only version available from Microsoft, with newer revisions being included in newer versions of Windows since.

Versions

[edit]
VersionIncluded withAlso available for
1.0Windows CE 3.0 (optional install on installer disc)
Windows 98,Windows 98 SE
Windows 95
Windows NT 4.0 SP3 or later
2.0 (also termed WSH 5.1)Windows 2000 RTM, SP1, SP2
Windows Me
Windows 95
Windows NT 4.0 SP4 or later
Windows 98
5.6Windows 2000 SP3 and later
Windows XP RTM, SP1, SP2
Windows Server 2003
Windows 9x
Windows NT 4.0 SP6a or later
5.7Windows XP SP3
Windows Vista
Windows Server 2008
Windows 2000 SP4 or later
Windows XP
Windows Server 2003
5.8Windows 7
Windows 8
Windows 8.1
Windows Server 2008 R2
Windows Server 2012
Windows Server 2012 R2
N/a
5.812Windows 10 and later
Windows Server 2016 and later
N/a

See also

[edit]

References

[edit]
  1. ^?MSDN, "Windows Scripting Host" and "VBScript"
  2. ^MSDN April 2000 edition, "Windows Scripting Host"
  3. ^The VBScript Bible (1999)
  4. ^Windows 2000 Server Resource Kit (documentation
  5. ^ab"What Is WSH?".msdn.microsoft.com. 24 October 2011.Archived from the original on 7 January 2018. Retrieved30 April 2018.
  6. ^"Windows Script Host Basics".msdn.microsoft.com. 24 October 2011.Archived from the original on 8 August 2017. Retrieved30 April 2018.
  7. ^"Windows Script Host Object Model".msdn.microsoft.com. 24 October 2011.Archived from the original on 8 August 2017. Retrieved30 April 2018.
  8. ^MSDN "VBA"
  9. ^User's Manual, Paint Shop Pro 8
  10. ^Paint Shop Pro 8 help, "Automation"
  11. ^main help file, Passport for Windows
  12. ^Take Command documentation 18.00 documentation hard copy and Help file
  13. ^Zoc v 6.0 help
  14. ^Zoc 5.0 printed manual
  15. ^MSDN documentation
  16. ^Windows Office 97 & 2000 Bibles (Wiley)
  17. ^Take Command version 18.00 documentation
  18. ^JP Software Take Command-4NT-4Dos-4OS/2 site, bulletin board
  19. ^Take Command 18.00 help
  20. ^"Norman - Antivirus & Security Software for Home & Business".AVG.com.Archived from the original on 21 February 2006. Retrieved30 April 2018.
  21. ^LLC), Tara Meyer (Aquent (30 June 2006)."Providing a Secure eXPerience".msdn.microsoft.com.Archived from the original on 10 November 2017. Retrieved30 April 2018.
  22. ^Windows Script Host 5.6 Boasts Windows XP Integration, Security, New Object ModelArchived 2008-02-18 at theWayback Machine
  23. ^CasioCalc.com, msgs of 15.09.2016
  24. ^"Notes/Domino 4 and 5 Forum : RE: Suggestion: Make LotusScript a script engine for Windows Scripting Host".Archived from the original on 2015-03-21. Retrieved2015-03-12.
  25. ^ASCI html help file
  26. ^ASCI site

links

[edit]
Retrieved from "https://en.wikipedia.org/w/index.php?title=Windows_Script_Host&oldid=1334086796"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp