在Windows中将目录添加到PATH环境变量 [英] Adding a directory to the PATH environment variable in Windows
问题描述
我正在尝试在Windows中将 C:\xampp\php
添加到我的系统 PATH
环境变量中
I am trying to add C:\xampp\php
to my system PATH
environment variable in Windows.
我已经使用环境变量对话框添加了它。
I have already added it using the Environment Variables dialog box.
但是当我在控制台中键入时:
But when I type into my console:
C:\>path
它不显示新的 C:\xampp\php
目录:
PATH=D:\Program Files\Autodesk\Maya2008\bin;C:\Ruby192\bin;C:\WINDOWS\system32;C:\WINDOWS;
C:\WINDOWS\System32\Wbem;C:\PROGRA~1\DISKEE~2\DISKEE~1\;c:\Program Files\Microsoft SQL
Server\90\Tools\binn\;C:\Program Files\QuickTime\QTSystem\;D:\Program Files\TortoiseSVN\bin
;D:\Program Files\Bazaar;C:\Program Files\Android\android-sdk\tools;D:\Program Files\
Microsoft Visual Studio\Common\Tools\WinNT;D:\Program Files\Microsoft Visual Studio\Common
\MSDev98\Bin;D:\Program Files\Microsoft Visual Studio\Common\Tools;D:\Program Files\
Microsoft Visual Studio\VC98\bin
我有两个问题:
- 为什么会这样?我有做错什么事吗?
- 此外,如何使用控制台将目录添加到
PATH
变量中(以及通过编程方式,
- Why did this happen? Is there something I did wrong?
- Also, how do I add directories to my
PATH
variable using the console (and programmatically, with a batch file)?
推荐答案
这只会修改注册表。现有流程不会使用这些值。如果在 之后开始 并且没有从其父级继承旧环境,则将启动一个新进程。
This only modifies the registry. An existing process won't use these values. A new process will do so if it is started after this change and doesn't inherit the old environment from its parent.
您没有指定如何启动控制台会话。确保这一点的最佳方法是退出命令外壳,然后再次运行它。然后,它应该继承更新后的PATH环境变量。
You didn't specify how you started the console session. The best way to ensure this is to exit the command shell and run it again. It should then inherit the updated PATH environment variable.
这篇关于在Windows中将目录添加到PATH环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!