Windows 7 environment variable not working in path

后端 未结 14 2090
[愿得一人]
[愿得一人] 2020-12-07 23:00

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_HO

相关标签:
14条回答
  • 2020-12-07 23:23

    Also worth making sure you're using the command prompt as an administrator - the system lock on my work machine meant that the standard cmd just reported mvn could not be found when typing mvn --version

    To use click 'start > all programs > accessories', right-click on 'command prompt' and select 'run as administrator'.

    0 讨论(0)
  • 2020-12-07 23:26

    I had the same problem, I fixed it by removing PATHEXT from user variable. It must only exist in System variable with .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

    Also remove the variable from user to system and only include that path on user variable

    0 讨论(0)
  • 2020-12-07 23:27

    If the PATH value would be too long after your user's PATH variable has been concatenated onto the environment PATH variable, Windows will silently fail to concatenate the user PATH variable.

    This can easily happen after new software is installed and adds something to PATH, thereby breaking existing installed software. Windows fail!

    The best fix is to edit one of the PATH variables in the Control Panel and remove entries you don't need. Then open a new CMD window and see if all entries are shown in "echo %PATH%".

    0 讨论(0)
  • 2020-12-07 23:29

    I had this problem in Windows 10 and it seemed to be solved after I closed "explorer.exe" in the Task Manager.

    0 讨论(0)
  • 2020-12-07 23:30

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

    • Put all variables in System Variables instead of User and add the ones you want to PATH

    Or

    • Put all variables in User Variables, and create or edit the PATH variables in User Variable, not In System. The Path variables in System don't expand the User Variables.

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

    0 讨论(0)
  • 2020-12-07 23:33

    Things like having %PATH% or spaces between items in your path will break it. Be warned.

    Yes, windows paths that include spaces will cause errors. For example an application added this to the front of the system %PATH% variable definition:

    C:\Program Files (x86)\WebEx\Productivity Tools;C:\Sybase\IQ-16_0\Bin64;
    

    which caused all of the paths in %PATH% to not be set in the cmd window.

    My solution is to demarcate the extended path variable in double quotes where needed:

    "C:\Program Files (x86)\WebEx\Productivity Tools";C:\Sybase\IQ-16_0\Bin64;
    

    The spaces are therefore ignored and the full path variable is parsed properly.

    0 讨论(0)
提交回复
热议问题