Infobox programming language
file_ext = .vbs
year = 1996
Windows Script Host, Active Server Pages
VBScript (short for Visual Basic Scripting Edition) is an
Active Scriptinglanguage developed by Microsoft. The language's syntax reflects its history as a limited variation of Microsoft's Visual Basicprogramming language.
VBScript is installed by default in every desktop release of
Microsoft Windowssince Windows 98, [ cite web | url = http://msdn2.microsoft.com/en-us/library/x66z77t4(VS.85).aspx | title = WSH Version Information | publisher = Microsoft| date = 2008 | accessdate = 2008-04-02 ] and may or may not be included with Windows CEdepending on the configuration and purpose of the device it is running on. It initially gained support from Windows administrators seeking an automation tool more powerful than the batch language first developed in the late 1970s.
A VBScript script must be executed within a host environment, of which there are several provided on a standard install of Microsoft Windows (
Windows Script Host, Internet Explorer). Additionally, The VBScript hosting environment is embeddable in other programs, through technologies such as the Microsoft Script control (msscript.ocx).
VBScript began as part of the Microsoft Windows Script Technologies, which were targeted at web developers initially and were launched in 1996. During a period of just over two years, the VBScript and JScript languages advanced from version 1.0 to 2.0 (the latter was later renamed 5.0) and over that time system administrators noticed it and began using it. In version 5.0, the functionality of VBScript was increased with new features such as
regular expressions, classes, the With statement, [cite web|url=http://msdn2.microsoft.com/en-us/library/zw39ybk8.aspx|publisher= Microsoft|title=Visual Basic Scripting Edition:With Statement (VBScript)|accessdate=2008-04-02|date=2008] Eval/Execute/ExecuteGlobal functions to evaluate and execute script commands built during the execution of another script, a function-pointer system via [http://msdn2.microsoft.com/en-us/library/ekabbe10.aspx GetRef()] , and Distributed COM (DCOM) support.
In 5.5, "Submatches" [cite web|url=http://msdn2.microsoft.com/en-us/library/y27d2s18.aspx|title= Visual Basic Scripting Edition: SubMatches Collection|publisher=
Microsoft|date=2008|accessdate=2008-04-02] were added to the regular expressionclass in VBScript to finally allow VBScript script authors to capture the text within the expression's groups. That capability before was only possible through the JScript member of the Microsoft ActiveX Scripting family.
As of 2007, no new functionality will be added to the VBScript language, which has been superseded by
Windows Powershell. However, it will continue to be shipped with future releases of Microsoft Windows, as will other components of the ActiveX Scripting Family (such as JScript). Additionally, support will continue due to the amount of code written in it and because it is still considered a useful tool for some tasks.
The language engine is currently being maintained by Microsoft's Sustaining Engineering Team, which is responsible for bug fixes and security enhancements.
When employed in Microsoft
Besides client-side web development, VBScript is used for server-side processing of web pages, most notably with Microsoft
Active Server Pages(ASP). The ASP engine and type library, asp.dll, invokes vbscript.dll to run VBScript scripts. VBScript that is embedded in an ASP page is contained within <% and %> context switches. The following example of an ASP page with VBScript displays the current time in 24-hour format (Note that an '=' sign occurring after a context switch (<%) is short-hand for a call to Write() method of the Response object).
VBScript can also be used to create applications that run directly on a person's computer running
Microsoft Windows. The simplest example of this is a script that makes use of the Windows Script Host(WSH) environment. Such a script is usually in a stand-alone file with the file extension
.vbs. The script can be invoked in two ways. Wscript.exe is used to display output and receive input in through a GUI, such as dialog and input boxes. Cscript.exe is used in a command line environment.
.vbsfiles can be included in two other types of scripting files:
.wsffiles, which are styled after XML; and
.htafiles, which are styled after HTML.
.wsffiles can be executed using wscript.exe or cscript.exe, just like
.wsffiles can include multiple
.vbsfiles. As a result
.wsffiles provide a means for code reuse: one can write a library of classes or functions in one or more
.vbsfiles, and include those files in one or more
.wsffiles to use and reuse that functionality in a modular way.
Another employment of VBScript is the
HTML Application, or HTA ( file extension
.hta). In an HTA, HTML is used for the user interface, and a scripting language such as VBScript is used for the program logic. HTAs run inside of
mshta.exe, which is a 'Trusted Application Environment' provided by
Internet Explorer. The 'Trusted Application Environment', implies that HTAs do not suffer the restrictions applied to applications running in the web or intranet zone, such as accessing local files or network paths. Although HTAs run in this 'trusted' environment, querying Active Directorycan be subject to Internet ExplorerZone logic and associated error messages.
VBScript (and JScript) can be used in a .wsc file to create a Windows Script Component - an ActiveX-enabled script class that can be invoked by other COM-enabled applications. [cite web|title=Introducing Windows Script Components |url=http://msdn2.microsoft.com/en-us/library/07zhfkh8(VS.85).aspx|date=2008|publisher=
Lastly, VBScript has been adopted as the internal scripting language for some embedded applications, such as industrial operator interfaces and human machine interfaces.Fact|date=September 2008
As-is, VBScript provides functions and sub-routines, basic date/time, string manipulation, math, user interaction, error handling, and regular expressions. Additional functionality can be added through the use of ActiveX technologies. File system management, file modification, and streaming text operations can be achieved with the Scripting Runtime Library scrrun.dll. Binary file and memory I/O is provided by the "ADODB.Stream" class, which can also be used as a string builder (since a high amount of VBScript string concatenation is costly due to constant memory re-allocation), and can be used to convert an array of bytes to a string and vice versa. Database access is made possible through
ActiveX Data Objects(ADO), and the IIS Metabasecan be manipulated using the GetObject() function with sufficient permissions (useful for creating and destroying sites and virtual directories). Additionally, XML files and schemas can be manipulated with the Microsoft XML Library Application Programming Interfaces (msxml6.dll, msxml3.dll), which also can be used to retrieve content from the World Wide Web via the XMLHTTP and ServerXMLHTTP objects (class strings "MSXML2.XMLHTTP.6.0" and "MSXML2.ServerXMLHTTP.6.0").lol
Windows Script File
* [http://msdn2.microsoft.com/en-us/library/t0aew7h6.aspx VBScript] in the Microsoft Developer Network
* [http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en Windows Script 5.6 Documentation]
Wikimedia Foundation. 2010.