Catalog / Windows Script Host (WSH) Cheatsheet
Windows Script Host (WSH) Cheatsheet
A comprehensive cheat sheet for Windows Script Host (WSH), covering essential objects, methods, and properties for automating tasks in Windows environments using VBScript or JScript.
WSH Core Objects
WScript Object
The |
Properties: |
|
Methods: |
|
WshShell Object
The |
Methods: |
|
Properties: |
|
File System Operations
FileSystemObject (FSO)
The |
Creating an instance:
|
Methods: |
|
Properties: |
|
File Object
The |
Methods: |
|
Properties: |
|
TextStream Object
The |
Methods: |
|
Properties: |
|
Networking and System Information
WScript.Network Object
The |
Methods: |
|
Properties: |
|
Environment Variables
|
Access system-wide environment variables. |
|
Access user-specific environment variables. |
|
Access volatile environment variables (exist only for the current session). |
|
Access environment variables specific to the current process. |
|
Expands environment variables within a string. Example shows accessing the PATH variable. |
Registry Access
|
Reads a value from the registry. |
|
Writes a value to the registry. |
|
|
Example: Read |
|
Example: Write |
|
Advanced Scripting Techniques
Running External Programs
The |
|
|
Example: |
|
Error Handling
Error handling in VBScript can be achieved using the |
Example: |
|
|
Event Logging
The |
|
|
Example: |
|