@echo off 
:start

IF EXIST "C:\Program Files (x86)\Yap\bin\yap.exe" goto register_64
IF EXIST "C:\Program Files\Yap\bin\yap.exe" goto register_x86
echo Entrer YAP Path [e.g. C:\Program Files\Yap\bin\]
set /p yapdir=
IF EXIST "%yapdir%\yap.exe" goto user_defined
echo Path entered incorrect
goto start

:user_defined
@echo Registering YAP (user defined)...
setx -m Path "%PATH%%yapdir%"
goto exit

:register_64
@echo Registering YAP (64 bit OS)...
setx -m Path "%PATH%;C:\Program Files (x86)\Yap\bin"
goto exit

:register_x86
@echo Registering YAP (32 bit OS)...
setx -m Path "%PATH%;C:\Program Files\Yap\bin"
goto exit

:exit
@echo.
@echo Done. Finished.
PAUSE