Last active
August 5, 2020 09:14
-
-
Save YazeedAlKhalaf/fae357096390f54a768f091a35efea7f to your computer and use it in GitHub Desktop.
A script to add a path to PATH environment variable on windows.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: PATH-ADD - add a path to user path environment variable | |
@echo off | |
setlocal | |
:: set user path | |
set ok=0 | |
for /f "skip=2 tokens=3*" %%a in ('reg query HKCU\Environment /v PATH') do if [%%b]==[] ( setx PATH "%%~a;%*" && set ok=1 ) else ( setx PATH "%%~a;%%~b;%*" && set ok=1 ) | |
if "%ok%" == "0" setx PATH "%*" | |
:end | |
endlocal | |
echo. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment