How do I set Windows environment variables permanently? [closed]
Asked Answered
B

2

11

How do I set Windows environment variables permanently?

I see that the Windows environment variables are reset when you close the command window. I want to set them permanently, so that I don't have to repeat the task every time I use the CLI.

Bahena answered 26/6, 2013 at 5:45 Comment(1)
This must already have been a mega duplicate in 2013. What is the canonical question?Dorella
E
9

Right click on Computer, Advanced system settings, select Advanced tab and click Environment variables.

Note: once you modify the environment variables, you will have to restart your applications, including CLI.

Exiguous answered 26/6, 2013 at 5:46 Comment(2)
For windows 8 users: Typing "Control Panel\All Control Panel Items\System" in the file explorer exposes the "Advance System Settings" link.Silkaline
This may depend on the version of Windows. What version is it?Dorella
J
10

This can also be achieved from a command prompt. The following example sets a variable at the user level:

SETX variable_name value

For machine level, elevation is required:

SETX variable_name value /m
Janeyjangle answered 26/4, 2019 at 13:59 Comment(1)
If you use this for updating %PATH%, this will cut it down to 1024 chars and potentially delete every path behind that range. So take care when using.Tallulah
E
9

Right click on Computer, Advanced system settings, select Advanced tab and click Environment variables.

Note: once you modify the environment variables, you will have to restart your applications, including CLI.

Exiguous answered 26/6, 2013 at 5:46 Comment(2)
For windows 8 users: Typing "Control Panel\All Control Panel Items\System" in the file explorer exposes the "Advance System Settings" link.Silkaline
This may depend on the version of Windows. What version is it?Dorella

© 2022 - 2024 — McMap. All rights reserved.