https://www.pdq.com/blog/categories/powershell/1
https://www.tenforums.com/tutorials/121664-set-new-user-system-environment-variables-windows.html
Set New User Environment Variables in Command Prompt
1 Open a command prompt.
2 Type the command below into the command prompt, and press Enter. (see screenshot below)
setx [variable name] "[variable value]"
Substitute [variable name] in the command above with the actual variable name (ex: “Downloads”) you want to use.
Substitute [variable value] in the command above with the actual variable value (ex: “C:\Users\Brink\Downloads”) you want to use.
3 You can now close the command prompt if you like.
Set New User Environment Variables in PowerShell
1 Open Windows PowerShell.
2 Type the command below into PowerShell, and press Enter. (see screenshot below)
[Environment]::SetEnvironmentVariable("[variable name]","[variable value]","User")
Substitute [variable name] in the command above with the actual variable name (ex: “Downloads”) you want to use.
Substitute [variable value] in the command above with the actual variable value (ex: “C:\Users\Brink\Downloads”) you want to use.
3 You can now close Windows PowerShell if you like.
Set New System Environment Variables in Command Prompt
You must be signed in as an administrator to do this option.
1 Open an elevated command prompt.
2 Type the command below into the elevated command prompt, and press Enter. (see screenshot below)
setx [variable name] "[variable value]" -M
Substitute [variable name] in the command above with the actual variable name (ex: “Downloads”) you want to use.
Substitute [variable value] in the command above with the actual variable value (ex: “%UserProfile%\Downloads”) you want to use.
3 You can now close the elevated command prompt if you like.
Set New System Environment Variables in PowerShell
You must be signed in as an administrator to do this option.
1 Open an elevated Windows PowerShell.
2 Type the command below into the elevated PowerShell, and press Enter. (see screenshot below)
[Environment]::SetEnvironmentVariable("[variable name]","[variable value]","Machine")
Substitute [variable name] in the command above with the actual variable name (ex: “Downloads”) you want to use.
Substitute [variable value] in the command above with the actual variable value (ex: “%UserProfile%\Downloads”) you want to use.
3 You can now close the elevated Windows PowerShell if you like.


