Environment variable is too large on Windows 10 Environment variable is too large on Windows 10 windows windows

Environment variable is too large on Windows 10


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.


There are a few ways to clean up your path variable. The easiest is to use Rapid Environment Editor. This free utility will,

  1. Remove the duplicate paths (right click → Cleanup Paths)
  2. Remove non-existent folders (shown in red which you need to manually delete)
  3. Replace long paths with short paths (right click → long to short path).

I do the above steps in order and use the third step only for the longest paths until the Path variable size is under control again.

If you want to go more advanced, here's a little C# tool that you can modify to whatever other logic you want to implement.


Another solution, or more a workaround to bypass the PATH environment variable length limit, is to manage your path (add, remove or update) using a PowerShell script;

  1. Capture the current PATH variable by clicking "Edit Text" (see above screenshot) and copy it to your clipboard and save it in a text file as a backup too to avoid bad surprises. This is not mandatory, but will allow you to recover should something go wrong.

  2. Now that it is backed up, add the following to a new PowerShell (.ps1) file (amending the first line below with the folder path(s) you want to add (the part after the + sign):

$newPath = $env:Path + '; C:\Users\....\FirstFolderToAddToPath; C:\Users\....\SecondFolderToAddToPath;'[Environment]::SetEnvironmentVariable("Path", $newPath, "Machine")$env:Path = $newPath

This is how I managed to get my (long) PATH variable back after playing with the Windows 10 UI, being caught by the length limitation and losing most of my path.