VB Script to read the environment variables


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 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

Reference: http://kapildmalhotra.blogspot.com/


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: