0

I created an environment variable as follows:

setx HTTPS_PROXY "website"

And when I try to print it out:

echo %HTTPS_PROXY%
%HTTPS_PROXY%
1
  • 3
    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. Commented Jun 15, 2016 at 15:50

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.