打印出环境变量

时间:2016-06-15 15:47:40

标签: cmd environment-variables

我创建了一个环境变量,如下所示:

setx HTTPS_PROXY "website"

当我尝试将其打印出来时:

echo %HTTPS_PROXY%
%HTTPS_PROXY%

1 个答案:

答案 0 :(得分:2)

PetSerAl's comment总结了color: function (color, d)

的原因
setx /?

解决方案:您需要使用SET command,例如如下。

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.
…

请注意,({复杂的} set "HTTPS_PROXY=website" setx HTTPS_PROXY "%HTTPS_PROXY%" 字符串只在上面的代码片段中输入一次(以避免键入错误)到目前为止website肯定匹配注册表中的数据:

%HTTPS_PROXY%