开发者

Windows: User environment variable cannot be displayed with echo

I am looking at a user environment variable created u开发者_运维知识库sing Windows console command

reg add "hkcu\environment" /v SARMaster_Server_Name /d %smServer%

This variable name SARMaster_Server_Name can be seen in the registry under HKCU/Environment with the correct value as well as through the advanced System settings of the Control Panel.

However, when I run

echo %SARMaster_Server_Name%

I get %SARMaster_Server_Name% instead of the actual value of this environment variable. What did I miss? All other environment variables such as TEMP can be echoed.


Variable is being set correctly using

reg add "hkcu\environment" /v SARMaster_Server_Name /d %smServer%

However, I need to restart to be able to access this variable. A workaround, which does not help in my scenario is to open the Environment Variables editor from the Control Panel and click on OK after the variable has been added using "reg add". Somehow, this action registers the new variable which can now be accessed on a new CMD session. Problem is being reported on XP so it may have been fixed on Windows 7 a

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜