Trying to set environment variables in windows powershell

by user99201   Last Updated August 14, 2019 15:01 PM

I'm trying to set the %systemroot% environment variable in powershell on windows 10. It's not working.

Here's what I've tried and the results:

$env:SystemRoot = "C:\Windows"
echo %SystemRoot%

setx SystemRoot "C:\Windows"
SUCCESS: Specified value was saved.
echo %SystemRoot%

What am I doing wrong?

Related Questions

How do I set Windows PowerShell ISE default theme?

Updated December 10, 2018 19:01 PM

Powershell to set default browser

Updated December 04, 2018 20:01 PM