2021-10-04 20:46:26 +01:00
|
|
|
# setx
|
|
|
|
|
2024-04-18 05:04:00 +01:00
|
|
|
> Set persistent environment variables.
|
2022-10-04 16:06:23 +01:00
|
|
|
> More information: <https://learn.microsoft.com/windows-server/administration/windows-commands/setx>.
|
2021-10-04 20:46:26 +01:00
|
|
|
|
|
|
|
- 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}}`
|