Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Environment variable is too large on Windows 10

I have recently upgraded to Windows 10 from Windows 8.1.

Now I wanted to set an environment variable for my new installation of Apache Maven.

Each time I created the user variable, things were fine. However, I also need to create the system variable where I will need to append the bin directory to the variable that I already create in the user variable to be "path".

Now, each time I do this, I get an error that says "This environment variable is too large". As a result of this, I am unable to create the path.

I have attached an image of this error.

Enter image description here

like image 960
olammy Avatar asked Dec 28 '15 09:12

olammy


People also ask

How do I increase the size of environment variables in Windows 10?

Try to modify by RegEdit. In my case it works when length is 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 the value of Path to your path.

How do you reset an environment variable in Windows?

2. Refresh Environment Variables via Command Prompt (CMD) Step 1: In the Start menu, search for Command Prompt and run it as an administrator. Step 2: Type the command: “set PATH = c” (without quotation marks), press the enter key, and restart the Command Prompt.


1 Answers

When the PATH environment variable gets overloaded with too many values it reaches a point where you cannot add values any more. Trying the following should solve your problem.

Solution 1:

  1. Create a new system environment variable, say 'NEWPATH'
  2. Assign the bin directory location to 'NEWPATH'
  3. Now append '; %NEWPATH%' to the PATH environment variable

If this still doesn't work then try to copy some part of the PATH environment variable already existing values to the 'NEWPATH' and then append the 'NEWPATH'.

Solution 2:

Check the value of the PATH environment variable if you can group and shorten the paths. For example,

C:\Program Files\Microsoft SQL Server\102\Tools\Binn;C:\Program Files\Microsoft SQL Server\102\DTS\Bin;

can be combined to

C:\Program Files\Microsoft SQL Server;

In this way, you can build more space into your fixed length PATH variable and finally adjust your bin directory location into PATH.

like image 145
Swapnil Kamat Avatar answered Oct 07 '22 18:10

Swapnil Kamat