@Echo Off
setlocal enableextensions enabledelayedexpansion
:lookforFGCBAHandler
For %%i IN (FGCBAHandler.exe) Do set FGCBAHandlerLocation=%%~$PATH:i
If not defined FGCBAHandlerLocation (For %%i In (FGCBAHandler.exe) Do If exist %%i set FGCBAHandlerLocation=%%~dpnxi)
If not defined FGCBAHandlerLocation goto error
Echo.
Echo * PLEASE WAIT: Registering FGCBAHandler to supported extensions...
FOR %%i IN (.ini .inf .cab .7z .zip .rar) Do call :registerloop "%%i"
Echo * SUCCESS: FGCBAHandler has been successfully registered.
goto end
:error
Echo * ERROR: Cannot find FGCBAHandler.exe in any of the folders defined by %%PATH%%.
goto end
:registerloop
If "%~1"=="" goto :EOF
set currentkey=%~1
Echo * Registering: %~1
:loop
REG QUERY "HKCR\%currentkey%\shell" 1>NUL 2>NUL
If errorlevel=1 (For /F "usebackq tokens=3 delims=
<tab>" %%i IN (`@reg query HKCR\%currentkey% /ve ^| find /I "REG_SZ"`) Do set currentkey=%%i
goto loop) ELSE (
set basekey=HKCR\%currentkey%\shell\FGCBAHandler
REG ADD "!basekey!" /ve /t REG_SZ /d "&FGCBA..." /f 1>NUL
REG ADD "!basekey!\command" /ve /t REG_SZ /d "\"%FGCBAHandlerLocation%\" \"%%1\"" /f 1>NUL
)
:end
endlocal
Bookmarks