mirror of
https://gitea.tendokyu.moe/beerpsi/fsdecrypt.git
synced 2026-09-22 22:17:55 +03:00
install-context-menu.bat / uninstall-context-menu.bat add a per-user (HKCU) Explorer entry for .app and .opt files, with an embedded unpack icon (assets/fsdecrypt.ico). No admin needed; the normal double-click association is untouched. The registered command keeps the console open after extraction. Documented in the README. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
49 lines
2.0 KiB
Batchfile
49 lines
2.0 KiB
Batchfile
@echo off
|
|
setlocal enabledelayedexpansion
|
|
rem ---------------------------------------------------------------------------
|
|
rem Adds an "Unpack with fsdecrypt" entry (with icon) to the right-click menu
|
|
rem of .app and .opt files. Per-user only (HKCU) -- no administrator needed,
|
|
rem and it does not change the normal double-click association.
|
|
rem
|
|
rem Place this next to fsdecrypt.exe and run it, or run it from the repo root
|
|
rem after `cargo build --release`. Run uninstall-context-menu.bat to undo.
|
|
rem ---------------------------------------------------------------------------
|
|
|
|
rem --- locate fsdecrypt.exe --------------------------------------------------
|
|
set "EXE="
|
|
if exist "%~dp0fsdecrypt.exe" set "EXE=%~dp0fsdecrypt.exe"
|
|
if not defined EXE if exist "%~dp0target\release\fsdecrypt.exe" set "EXE=%~dp0target\release\fsdecrypt.exe"
|
|
if not defined EXE if exist "%~dp0target\debug\fsdecrypt.exe" set "EXE=%~dp0target\debug\fsdecrypt.exe"
|
|
if not defined EXE (
|
|
echo ERROR: could not find fsdecrypt.exe next to this script or under target\.
|
|
echo Build it first: cargo build --release
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
rem --- locate the icon (optional) --------------------------------------------
|
|
set "ICON="
|
|
if exist "%~dp0fsdecrypt.ico" set "ICON=%~dp0fsdecrypt.ico"
|
|
if not defined ICON if exist "%~dp0assets\fsdecrypt.ico" set "ICON=%~dp0assets\fsdecrypt.ico"
|
|
|
|
echo Using exe : !EXE!
|
|
if defined ICON (echo Using icon: !ICON!) else (echo Using icon: ^(none found^))
|
|
echo.
|
|
|
|
call :install ".app"
|
|
call :install ".opt"
|
|
|
|
echo.
|
|
echo Done. Right-click a .app or .opt file to see "Unpack with fsdecrypt".
|
|
echo ^(On Windows 11 it is under "Show more options".^)
|
|
pause
|
|
exit /b 0
|
|
|
|
:install
|
|
set "KEY=HKCU\Software\Classes\SystemFileAssociations\%~1\shell\fsdecrypt"
|
|
reg add "%KEY%" /ve /d "Unpack with fsdecrypt" /f >nul
|
|
if defined ICON reg add "%KEY%" /v Icon /d "!ICON!" /f >nul
|
|
reg add "%KEY%\command" /ve /d "cmd /c \"\"!EXE!\" \"%%1\" ^& pause\"" /f >nul
|
|
echo installed for %~1
|
|
goto :eof
|