Windows 7 环境变量在路径中不起作用 [英] Windows 7 environment variable not working in path

查看:54
本文介绍了Windows 7 环境变量在路径中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用环境变量设置一些路径.我添加了一个值为C:maven"的环境变量MAVEN_HOME".然后在路径中我添加了%MAVEN_HOME%in;...rest".当我输入echo $MAVEN_HOME%"时,我会在屏幕上打印出正确的C:maven".但是当我在bin"目录下输入批处理文件mvn"时,却找不到.

I am trying to set up some path using environment variable. I added an environment variable "MAVEN_HOME" with the value "C:maven". Then in the path I added "%MAVEN_HOME%in;...rest". When I type "echo $MAVEN_HOME%" I get the correct "C:maven" printed on the screen. But when I type "mvn" which is a batch file in the "bin" directory, it can't find it.

所以,我在 PATH 中手动添加了整个路径."C:mavenin;...休息"它能够找到mvn"并执行它.

So, I manually added the entire path in PATH. "C:mavenin;...rest" and it was able to find "mvn" and execute it.

有人能帮我做错什么吗?

Could someone help me what I did wrong?

推荐答案

我遇到了完全相同的问题,要解决它,您可以做以下两件事之一:

I had exactly the same problem, to solve it, you can do one of two things:

  • 将所有变量放在系统变量中而不是用户中,并将您想要的变量添加到 PATH 中

或者

  • 将所有变量放在用户变量中,并在用户变量中创建或编辑 PATH 变量,而不是在系统中.系统中的路径变量不会扩展用户变量.

如果以上都正确,但问题仍然存在,您需要检查系统注册表,在HKEY_CURRENT_USEREnvironment,确保PATH"键类型为REG_EXPAND_SZ(不是REG_SZ).

If the above are all correct, but the problem is still present, you need to check the system Registry, in HKEY_CURRENT_USEREnvironment, to make sure the "PATH" key type is REG_EXPAND_SZ (not REG_SZ).

这篇关于Windows 7 环境变量在路径中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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