VB Script to read the environment variables
Many time working with the application either the Web based or some install application we need to read the environment variables.
The user can create either of the following environments variable based on their need.
1. User Environment variable
2. System Environment variable
VB Script to Read the User Environment Variable
Dim oWsh, Shell
Set oWsh = CreateObject(“WScript.Shell”)
Set Shell = oWsh.Environment(“USER”)
Path = Shell.Item(“USERVAR”)
WScript.echo Path
WScript.Quit(0)
VB Script to Read the System Environment Variable
Dim oWsh, Shell
Set oWsh = CreateObject(“WScript.Shell”)
Set Shell = oWsh.Environment(“System”)
Path = Shell.Item(“SYSTEMVAR”)
WScript.echo Path
WScript.Quit(0)
Hope this straight forward technique will help