When I set a environment variable envir
using setx
command, It seems to not actually 'set' in environment.
setx envir "windows"
if 1==1 (
setx envir "unix"
)
echo %envir%
set
The set
command displays a list of environment variable but it doesn't display the variable which was currently set by the previous line.
In your example, the environment variable %ENVIR%
is set to "windows
". This is stored in the user-specific environment variables in the Windows
registry. The change is not directly reflected in the environments of currently active processes.
To actually see this new setting via set
command, you have to open a new command box using cmd.exe
. The current command box does not automatically re-read changed settings from the registry. You could also use the system control SYSTEM
and look under Extended Properties / Environment
:
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments