In Windows, is there any shell/Powershell command to list User Environment Variable and System Environment Variable separately. If I do -
SET TEMP
Windows displays the User Environment Variable instead of System variable for Temp.
I am looking for shell command/switch to display these variables separately.
Use the following batch file:
To use from a command line replace
%%
with%
.Output:
Note that the
HKEY_CURRENT_USER
takes precedance (but for some reason%USERPROFILE%
is expanded to a shortname when evaluating%TEMP%
):In PowerShell, there's no cmdlet for it, but you can use the underlying .NET methods in the Environment class: