HomeNT
WSH Books, Websites etc

An A-Z Index of WSH commands

Arguments, display - WshArguments.Item (also Count and length)

Command, cscript - Run a VBS/WSH Script
Command, .Run command
Command, .Exec execute command 
Command, .AppActivate activate running command
.CurrentDirectory

Echo text    .Echo
Echo text to StdOut.Write
Echo, popup  .Popup
Environment, read env variables   - .Environment
Environment, expand env variables - .ExpandEnvironmentStrings
Environment, delete env variables - .WshEnvironment.Remove

Environment, echo .ComputerName
Environment, echo .UserName
Environment, echo .UserDomain

Log an item in the Event log .LogEvent

Object, create     - .CreateObject
Object, get        - .GetObject
Object, disconnect - .DisconnectObject

NET, net use drive       -  .MapNetworkDrive
NET, list drive mappings -  .EnumNetworkDrives
NET, remove drive map    -  .RemoveNetworkDrive
     a simple DriveMap Script

Path of wscript.exe          - .Name
Pathname of wscript.exe      - .FullName
Pathname of script being run - .ScriptFullName
Path to desktop,start menu.. - .SpecialFolders
Printer, add printer         - .AddPrinterConnection
Printer, add Network printer - .AddWindowsPrinterConnection
Printer, list printers       - .EnumPrinterConnections
Printer, set default printer - .SetDefaultPrinter
Printer, remove printer      - .RemovePrinterConnection 

Quit    - .Quit

Registry, delete - .RegDelete
Registry, read   - .RegRead
Registry, write  - .RegWrite

Send Keys - .SendKeys
Shortcut,create - .CreateShortcut
Sleep - .Sleep

text input          - .ReadLine
text output         - .Write
Version of wscript  - .Version

Syntax
Variables, Functions, Operators,
Conditional and looping Statements
.

Examples:
DriveMap.vbs - Connect to a network file share.
qchange.vbs - Re-assign network printer connections
compinfo.vbs - List Computer properties (as shown in ADUC)
userinfo.vbs - List User properties (as shown in ADUC)
datetime.vbs - Get Date, Time and daylight savings
uname.vbs - List user's simple name when called with a Distinguished Name
Localadmins.vbs - List local administrators across a network domain

All the syntax on this page assumes you have WSH version 5.6 or greater. Examples are in VB Script.

Naming conventions.
Other sources of help...


Back to the Top

Simon Sheppard
SS64.com