I don't know how to change an environment variable in the system GUI and then "learn" it in an existing command Window.
However, I don't use the GUI any more, because I can set both global and local environment variables at the command line. No GUI ever needed. If you have a way to always avoid using the GUI, perhaps your problem becomes more tractable?
The downside is that there is one command to set the global environment variable, and another for the local command window. I don't know a way to source them both in one command. Instead, I have a .BAT file that takes my variable name and value as arguments, and sets the global and local environment variable at the same time. The next command window or GUI app will see the new value. I don't think running GUI apps or other open command windows will however.
C:>SET_ENVVARS.BAT MYVAR MYVAL
SET %1=%2
CALL SETX %1 %2 /M
You have all the limitations of the command line, such as escape characters and quoting, but most of the time this works pretty well.
My .BAT file has a few bells and whistles in it, but at its core, that's it.
I very rarely have to have to use the GUI.
I also occasionally "dump" my environment variables with:
C:\>SET >MYVARS.TXT
A little smithing would let you source from that.
Its not a quick fix, but I invest a lot of time in my .BAT file infrastructure and find that in the long run I save more time by reframing my problem to match the way Windows .BAT files work best. Beyond that, sometimes I resort to C, for example to list all PATH elements, but each on a separate line.
cmd
shell.