Environment Variable is too large on Windows 10

前端 未结 13 1884
轮回少年
轮回少年 2020-12-12 09:28

I know this is strange and I have spent almost 3 days searching for the solution online without getting a useful one. So I have decided to come here.

I have recentl

相关标签:
13条回答
  • 2020-12-12 09:52

    Apparently Rapid Environment Editor will do this for you (from @shital_shah answer), but you can also shorten the paths to their "8dot3" version. You will get a lot of mileage with just these two replacements:

    C:\Program Files       --> C:\PROGRA~1
    C:\Program Files (x86) --> C:\PROGRA~2
    

    If you copy your current path into Notepad first search and replace C:\Program Files (x86) and then C:\Program Files.

    0 讨论(0)
  • 2020-12-12 09:53

    I found you can do via PowerShell.

    [System.Environment]::SetEnvironmentVariable("PATH", "C:\Program Files (x86......etc.....", "Machine")
    

    So I grabbed existing system PATH, pasted into notepad, added my new thing, then pasted into the "C:\Program Files" bit of the above. Path updated. Done.

    0 讨论(0)
  • 2020-12-12 09:56

    Late answer but I was looking for something similar and ended up here. I changed all the paths to variables for program files and programdata (this one saves like 1 character though not as important).

    For something like nodejs, i changed the normal path of

    C:\Program Files\nodejs\

    to

    %ProgramFiles%\nodejs\

    This can be done with "C:\Program Files (x86)\" as well using "%ProgramFiles(x86)%\"

    It saved me a few characters but enough that it stopped complaining I feel.

    0 讨论(0)
  • 2020-12-12 09:58

    Try modify by regedit, in my case it works when length more than 3000.

    Press Win + R and enter regedit to open regedit. Go to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment, and modify value of Path to your path. And restart computer, it should works.

    0 讨论(0)
  • 2020-12-12 09:58

    I had exactly the same problem, eventually I had to delete one of the existing variable to make the total length < 2047. Then I could add %MAVEN_HOME%\bin to the path variables.

    0 讨论(0)
  • 2020-12-12 10:02

    Workarround. Use Edit Text and edit your PATH in a text Editor

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