Skip to content

Instantly share code, notes, and snippets.

@timmyRS
Last active September 15, 2019 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timmyRS/c089f02aaeb671d9ebb07202cc5fba46 to your computer and use it in GitHub Desktop.
Save timmyRS/c089f02aaeb671d9ebb07202cc5fba46 to your computer and use it in GitHub Desktop.
A batch script to add your folder to %PATH% avoiding the 1024 character limit.
REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /F /V PATH /T REG_SZ /D "YOUR_PATH_FOLDER;%PATH%"
:: Setting a temporary dummy variable so setx will broadcast WM_SETTINGCHANGE so the PATH change is reflected without needing a restart.
SETX /m DUMMY ""
REG DELETE "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /F /V DUMMY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment