Implemented add_to_path.cmd
This commit is contained in:
parent
f2544d18d2
commit
7b4dc3574b
23
add_to_path.cmd
Normal file
23
add_to_path.cmd
Normal file
@ -0,0 +1,23 @@
|
||||
@echo off
|
||||
@setlocal
|
||||
rem cobbled together by https://github.com/nefarius
|
||||
|
||||
set MYDIR=%~dp0
|
||||
pushd "%MYDIR%"
|
||||
|
||||
SETLOCAL EnableDelayedExpansion
|
||||
|
||||
NET SESSION >nul 2>&1
|
||||
IF %ERRORLEVEL% EQU 0 (
|
||||
for /d %%d in (*.*) do (
|
||||
set value=%MYDIR%%%d
|
||||
echo Adding !value! to system PATH
|
||||
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path /t REG_EXPAND_SZ /d "%value%" /f
|
||||
)
|
||||
) ELSE (
|
||||
ECHO You need to run this script as Administrator
|
||||
)
|
||||
|
||||
popd
|
||||
endlocal
|
||||
pause
|
Loading…
Reference in New Issue
Block a user