[environment] can't update environment variables
See original GitHub issueSteps to reproduce
Install powershell from microsoft store
[environment]::setEnvironmentVariable('TEST_URL','http:url','User')
Expected behavior
reopen shell
$env:TEST_URL
output: http:url
Actual behavior
reopen shell
$env:TEST_URL
output is empty
Environment data
Name Value
---- -----
PSVersion 7.1.0
PSEdition Core
GitCommitId 7.1.0
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Can't edit environment variables in windows 10
I got around it by opening the System page in Control Panel (Win+X -> Y), going to "Advanced system settings", then clicking "Environment ......
Read more >5 reasons why your .env environment variables don't work
1. Your framework doesn't automatically load .env files. · 2. You added or otherwise updated your .env file after starting your server. ·...
Read more >Can't change environment variables in windows 10
In windows 10 whether I go to the control panel or through the start panel, nothing happen when I click to edit the...
Read more >conda env update doesn't update environment variables
I've noticed that the conda_env cli option for updating conda environment from a yml file doesn't create/update environment variables.
Read more >Python: Environment Variables not updating
I am trying to overwrite to environment variables in Python. I can read the value and then write the value and print the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@vexx32
The ‘reopen shell’ operation that I missed in the issue description
Now, i can understand MSIX specific limitation.
run command in powershell installed from msix, and reopen shell and see
$env:TEST_URLrun command in windows powershell, and reopen shell and see
$env:TEST_URL@iSazonov This is MSIX specific. The MSIX sandbox virtualizes some registry access.
[Environment]::SetEnvironmentVariable('TEST_URL', 'http:url', 'User')writes the value to the User registry, which is virtualized. So the change is not persistent across sessions.