How to set persistent environment variables with command line in windows

Environment variables are not often seen directly when using Windows. However there are cases, especially when using the command line, that setting and updating environment variables is a necessity.

I always new the set command line command to set environment variables in windows, but to make a system wide effect of the environment variable, this command needs users to logout and login again.

To set persistent environment variables at the command line, we can use setx.exe. It became part of Windows as of Vista/Windows Server 2008.

setx.exe does not set the environment variable in the current command prompt, but it will be available in subsequent command prompts.

for more info type the following in the windows command

set /?

or

setx /?

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 )

Connecting to %s