VBScript Tutorials - Herong's Tutorial Examples - Version 5.20, by Dr. Herong Yang

What is WSH (Windows Script Host)?

This section describes WSH (Windows Script Host) and its features. WSH is a Windows system administration tool to run VBScript code to common administrative tasks.

WSH (Windows Script Host) is a language-independent scripting host for Windows Script compatible scripting engines like VBScript engine and JScript engine. WSH brings simple, powerful, and flexible scripting to the Windows 32-bit platform, allowing you to run scripts from both the Windows desktop and the command prompt.

Windows Script Host is ideal for non-interactive scripting needs, such as logon scripting, administrative scripting, and machine automation.

WSH 5.6, installed as part of Windows XP systems, offers the following features:

  • There are two hosts provided in WSH 5.6: CScript.exe and WScript.exe.
  • CScript.exe host running scripts with a command window as console for standard input and output.
  • WScript.exe host running scripts without any command window. Standard input and output are not available in this case.
  • Several runtime objects are provided for administrative tasks like managing files and folders, mapping network drives, managing environment variables, and modifying registry keys.
  • Different types of script files are supported: *.vbs (VBScript file), *.wsf (Windows Script File).
  • A .vbs file, or VBScript file, contains only VBScript statements.
  • A .wsf file, Windows Script File, contains scripting codes in an XML file format.

Table of Contents

 About This Book

 Introduction of VBScript - Visual Basic Scripting Edition

 Variant Data Type, Subtypes, and Literals

 Arithmetic Operations

 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

 Built-in Functions

 Inspecting Variables Received in Procedures

 Error Handling Flag and the "Err" Object

 Regular Expression Pattern Match and Replacement

 scrrun.dll - Scripting Runtime DLL Library

 Creating Your Own Classes

 IE Web Browser Supporting VBScript

 IIS ASP Server Supporting VBScript

WSH (Windows Script Host)

What is WSH (Windows Script Host)?

 "csript.exe/wscript.exe" Command Version and Options

 Running VBScript Code Files

 "WScript" Runtime Object Hierarchy

 "oShell.Exec(cmd)" - Running System Command with a Script

 WSF - Windows Script File XML Format

 References

 Printable Copy - PDF Version

What is WSH (Windows Script Host)? - Updated in 2015, by Dr. Herong Yang