| TABLE 1: WSH Counterparts to Batch File Commands |
Logon Script Task |
Batch File Solution |
WSH Solution |
| Determining directory and disk space utilization |
Resource kit utilities diruse.exe and diskuse.exe |
VBScript's FileSystemObject |
| Performing file I/O |
Command redirection symbols(e.g., >, >>, <, |) and command filters (e.g., find, more, sort) |
VBScript's FileSystemObject |
| Using environment variables |
Command processor's Set command and %EnvironmentVariable% construct |
WSH Shell object's Environment property |
| Handling errors |
ERRORLEVEL environment variable |
VBScript's Err object |
| Accepting user input |
Command-line arguments the script accesses via %1, %2, %3, etc. |
Command-line arguments the script accesses via WScript's Arguments property, or arguments the user enters interactively and the script accesses via VBScript's InputBox function |
| Providing script output |
Command processor's Echo command |
WScript's Echo method, WSH Shell object's Popup method, or VBScript's MsgBox function |
| Establishing network connections |
NT's net.exe commands |
WSH Network object |
| Performing Registry I/O |
Resource kit utility reg.exe |
WSH Shell object's RegDelete, RegRead, and RegWrite methods |
| Running external commands |
Command or utility name |
WSH Shell object's Run method |
| Searching via regular expressions |
Command redirection symbols (e.g., <, |) and command filters (e.g., find, findstr) |
Forthcoming VBScript RegExp object |
| Manipulating groups and users |
NT's net.exe commands and a variety of resource kit and third-party utilities |
ADSI |