How do you avoid over-populating the PATH Environment Variable in Windows?

This will parse your %PATH% environment variable and convert each directory to its shortname equivalent and then piece it all back together: @echo off SET MyPath=%PATH% echo %MyPath% echo — setlocal EnableDelayedExpansion SET TempPath=”%MyPath:;=”;”%” SET var= FOR %%a IN (%TempPath%) DO ( IF exist %%~sa ( SET “var=!var!;%%~sa” ) ELSE ( echo %%a does not … Read more