Below are a few basic examples of how to read and set Environment Variables using a VBS Script.

Create a new Permanent System Environment Variable

The below example creates a new permanent System Environment variable called “test” with the value “Hello World!”

If you get an Access Denied message on Vista the fault of “User Account Control”

Create a new Permanent User Environment Variable

The below example creates a new permanent User Environment variable called “test” with the value “Hello World!”

If you get an Access Denied message on Vista the fault of “User Account Control”

Reading a System Environment Variable

The below example shows how to read a System Environment Variable called “test”

Reading a User Environment Variable

The below example shows how to read a User Environment Variable called “test”

Practical Example: Appending to the System Environment Variable “Path”

One of my more common reasons for playing around with Environment Variables