VBScript Tutorials - Herong's Tutorial Examples - v6.03, by Herong Yang
Using VBScript with WSH (Windows Script Host)
This section provides tutorial example on how to run a simple VBScript code file with the Windows Script Host tool.
Windows Script Host (WSH) is a Windows administration tool that provides host environments for several scripting languages including VBScript.
VBScript code included in script files will be executed by WSH directly on the Windows operating system.
If you are running a Windows XP system, you can try these steps to run a simple VBScript code with Windows Script Host:
1. Create a script file called hello.vbs:
WScript.StdOut.WriteLine "Hello World! - VBScript in WSH"
2. Run hello.vbs with the "cscript" command in a command window:
C:\herong>cscript hello.vbs Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. Hello World! - VBScript in WSH
Congratulations. You have successfully written a VBScript code for the host environment provided by WSH!
What happened here was:
Table of Contents
►Introduction of VBScript - Visual Basic Scripting Edition
Using VBScript with Internet Explorer 10 or Older
Using VBScript with Internet Explorer 11
Using VBScript with Internet Information Services
►Using VBScript with WSH (Windows Script Host)
Using Visual Basic with Microsoft Access
VBScript and Supporting Environments
Variant Data Type, Subtypes, and Literals
Numeric Comparison Operations and Logical Operations
String Operations - Concatenation and Comparison
Variable Declaration and Assignment Statement
Expression and Order of Operation Precedence
Statement Syntax and Statement Types
Array Data Type and Related Statements
Array References and Array Assignment Statements
Conditional Statements - "If ... Then" and "Select Case"
Loop Statements - "For", "While", and "Do"
"Function" and "Sub" Procedures
Inspecting Variables Received in Procedures
Error Handling Flag and the "Err" Object
Regular Expression Pattern Match and Replacement
scrrun.dll - Scripting Runtime DLL Library
IE Web Browser Supporting VBScript