@echo OFF :: Checking parameters if "%~1"=="" ( echo ERROR: Please specify path to a file or folder to be decrypted. echo Usage: %0 ^ ^[output_directory^] exit /b ) else if not exist "%~1" ( echo ERROR: File not found at "%~1" exit /b ) set "FILE=%~1" :: Output directory: :: if not provided by the user, set to a random TEMP folder. if not "%~2"=="" ( set "OUTDIR=%~2" ) else ( set "OUTDIR=%TEMP%\steg\%RANDOM%" ) :: Checking if 7z is available where 7z >nul 2>&1 || ( echo ERROR: 7z is not installed or not found in the system PATH. echo Please install 7z or ensure it's in the system PATH. exit /b ) :: Since 7z will not prompt the user to enter password, :: we do it here in advance. echo Enter password: :: Decrypt and extract the file to output folder 7z x "%FILE%" -o"%OUTDIR%" -y > nul 2>&1 echo. :: Check if decryption was successful if errorlevel 1 ( echo FAIL: Unable to decrypt the file. ) else ( echo SUCCESS! :: Open the output folder for the user %SystemRoot%\explorer.exe "%OUTDIR%" ) rem PAUSE