setx
Sets persistent environment variables. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/setx.
-
Set an environment variable for the current user:
setx {{variable}} {{value}}
-
Set an environment variable for the current machine:
setx {{variable}} {{value}} /M
-
Set an environment variable for a user on a remote machine:
setx /s {{hostname}} /u {{username}} /p {{password}} {{variable}} {{value}}
-
Set an environment variable from a registry key value:
setx {{variable}} /k {{registry\key\path}}
License and Disclaimer
The content on this page is copyright © 2014—present the tldr-pages team and contributors.This page is used with permission under Creative Commons Attribution 4.0 International License.
While we do attempt to make sure content is accurate, there isn't a warranty of any kind.