发布网友
共1个回答
热心网友
@echo off
set "str=HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
for /f "skip=2 tokens=2*" %%a in ('REG QUERY "%str%" /v Path') do set "regstr=%%b"
echo %regstr%|find ";%~dp0">nul&&echo 已经存在%~dp0||(
setlocal enabledelayedexpansion
set "regstr=!regstr!;%~dp0"
reg add "!str!" /v Path /t REG_EXPAND_SZ /f /d "!regstr!
endlocal
)
pause&exit /b