I created an environment variable as follows:
setx HTTPS_PROXY "website"
And when I try to print it out:
echo %HTTPS_PROXY%
%HTTPS_PROXY%
PetSerAl's comment summarizes the reason from setx /?:
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. …
Solution: you need to use SET command, e.g. as follows.
set "HTTPS_PROXY=website"
setx HTTPS_PROXY "%HTTPS_PROXY%"
Note that (supposedly complex) website string is typed only once in above code snippet (to avoid a keying mistake) in so far that %HTTPS_PROXY% surely matches data in registry:
reg query hkcu\environment /V HTTPS_PROXY
setx /?: Note: 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.