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
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
.