回波%PATH%只能扩展到系统还是用户变量? [英] Does echo %PATH% expand to only the system or also the user variables?

查看:171
本文介绍了回波%PATH%只能扩展到系统还是用户变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在最佳答案的最高投票评论中(如何在批处理文件中持久设置Windows 7中的变量?)提到%PATH%扩展到系统加上用户变量。真的吗?在我的笔记本电脑中,如果我打开cmd和我的数字

  echo%PATH%
/ pre>

我只看到系统变量。有人可以澄清这一点吗?



cheers
A。

解决方案

默认情况下,赋予新进程的环境会合并系统和用户变量。因此,如果您为系统和用户定义了一个 PATH 变量,那么两个值将合并。



您的实验似乎与上述我的说法相矛盾。但是,当我重复实验时,我可以看到系统和用户设置中的值合并。所以我只能断定你没有正确地执行你的实验。



更新:也许这个 MSDN主题关于环境变量的评论可能是相关的:


发现在Windows Server 2003上,一旦系统PATH通过1920个字符,用户PATH环境变量就不再与其合并,以设置进程PATH环境变量,即使完整系统PATH(即使较大)将被包含在进程PATH变量中。



In the top voted comment of the best answer here (How to persistently set a variable in Windows 7 from a batch file?) it is mentioned that %PATH% expands to the system plus the user variables. Is that true? In my laptop if I open cmd and I digit

    echo %PATH% 

I only see the system variables. Can anybody clarify this point?

cheers A.

解决方案

The environment that is, by default, given to a new process, merges both system and user variables. So, if you have a PATH variable defined for both system and user then the two values are merged.

Your experiment appears to contradict my statement above. However, when I repeat your experiment I can see values from both system and user settings merged. So I can only conclude that you are not performing your experiment correctly.

Update: Perhaps this comment from the MSDN topic on environment variables might be pertinent:

Found out that on Windows Server 2003, once the system PATH passes 1920 characters, the user PATH environment variable is no longer merged with it to set the process PATH environment variable, even though the full system PATH (even if larger) will be included in the process PATH variable.

这篇关于回波%PATH%只能扩展到系统还是用户变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆