All languages

VBScript dialectdormant

Microsoft's scripting subset of Visual Basic for Internet Explorer, IIS and the Windows Script Host. One Variant data type, late-bound COM automation, and classes without inheritance; deprecated since 2023 and on a phased removal path.

Overview

VBScript is Microsoft's scripting subset of Visual Basic, embedded in Internet Explorer, IIS, and the Windows Script Host so a web page or an administrator's .vbs file could drive COM objects. It traded Visual Basic's declared types for a single Variant, and its classes stop short of inheritance — a trim that leaves it object-based rather than object-oriented.

Code

Option Explicit

Dim total, greeting
total = 42                        ' Integer subtype, assigned at run time
greeting = "VBScript " & 5.8      ' & coerces the number to a string
WScript.Echo TypeName(total / 4) & " " & (total / 4)   ' Double 10.5
Every value is a Variant, so TypeName reports the subtype the run time chose; arrays are addressed by LBound/UBound; Class gives properties and private members but no base-class clause, which is why reuse is written as an object held and forwarded; and COM automation is late bound, so On Error Resume Next plus the Err object is the whole failure story.

Distinctive traits

  • One data type: every variable is a Variant, and the run time picks the subtype, so no declaration prevents a string from reaching an arithmetic operator.
  • Late binding only: CreateObject resolves a ProgID at run time, so a script needs no type library and no compile step.
  • Classes have no base-class clause: Class/End Class yields properties, methods and Private state, so reuse is delegation, not subclassing.
  • Inline error handling: On Error Resume Next continues after a failure so the next statement can read Err.Number.
  • The host supplies the library: the same .vbs runs under IIS, WSH or a third-party application, and each host exposes a different object model.
  • Late binding reaches declarations too: a class object cannot be typed, so Dim x As New Counter is not available and every member resolves at run time.

Status

Deprecated, not gone. Microsoft announced deprecation in October 2023; Windows 11 24H2 ships it as a pre-enabled Feature on Demand, around 2027 that default turns off, and a later phase removes the DLLs.

History

Version 1.0 shipped with Internet Explorer 3.0 in 1996 and 2.0 with IIS 3.0 the same year, adding CreateObject and arrays. Version 5.0 brought classes, the RegExp object, Eval/Execute and function pointers; 5.8, the highest release in Microsoft's version table, arrived with Internet Explorer 8 and Windows 7.

Sources & references