@ECHO OFF

SET regKey="HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment"
SET regVal=Path

REG QUERY %regKey% /v %regVal% 1>NUL 2>&1
IF NOT %ERRORLEVEL% == 0 (
    GOTO END
)

FOR /F "tokens=2*" %%i IN ('REG QUERY %regKey% /v %regVal%') DO (  
    IF NOT "%%j" == "" (
        SET envPath=%%j
    )	
)

SET path=%path%;%envPath%

:END