Remove unwanted path name from %path% variable via batch

This removes the substring C:\Program Files (x86)\Git\bin; from the PATH string and re-assigns:

set PATH=%PATH:C:\Program Files (x86)\Git\bin;=%

You might use this to see the change:

echo %PATH:C:\Program Files (x86)\Git\bin;=% | tr ; \n

Note: be exact on the substring. It’s case-sensitive and slash-sensitive.

If you need to make it a persistent change use setx instead of set and open another console for changes to take effect.

setx /M PATH "%PATH:C:\Program Files (x86)\Git\bin;=%"

Leave a Comment