Windows Powershell – Setting Environment Variable

The following describes how to leverage the $ENV:PATH syntax within powershell to add a value to the Path environment variable, please note changing the environment variables using this method only works for the current powershell session. If you wish to make this change persist in the registry then use System properties->Advanced->Environment Variables->Path->Edit->Edit Text 

psenvpath1

Example of appending directory “;c:\DRing” to the Path using $ENV:PATH

$ENV:PATH = $ENV:PATH + “;c:\DRing”

Validate the change by simply using $ENV:PATH

psenvpath2

Display the environment variables using Get-ChildItem Env:

psenvpath3

Note: if you discover that after updating the environment variables via system properties and they do not appear to propagate in powershell then log off and on and the changes should now appear after creating a new explorer.exe session. Alternatively try launching powershell from start menu as opposed to taskbar shortcut.

Useful Reference:

About Environment Variables

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s