Axel is correct.
setx
stores the variable in the registry, but the change is not reflected in the environment of ANY running program (including the current one).
Here are some relevant parts of the output of setx /?
:
C:\>setx /?
Description:
Creates or modifies environment variables in the user or system
environment. Can set variables based on arguments, regkeys or
file input.
NOTE: 1) SETX writes variables to the master environment in the registry.
2) On a local system, variables created or modified by this tool
will be available in future command windows but not in the
current CMD.exe command window.
3) On a remote system, variables created or modified by this tool
will be available at the next logon session.
or after running
setx aaa 3
, runset aaa=3
to set it in the current cmd prompt. Also, setx can be a bit dangerous, it's worth doingset>a.a
first so if setx does write something a way you didn't intend, then you have a backup – barlop – 2016-07-09T10:30:16.343