From 197142f03bdefa26e40890c6490da0bb6014f96d Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 24 Jul 2025 14:25:33 +0200 Subject: tools: Add an experimental Windows descryption script. -- I am not sure whether this really works. --- tools/decrypt.bat | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tools/decrypt.bat diff --git a/tools/decrypt.bat b/tools/decrypt.bat new file mode 100644 index 000000000..808689a11 --- /dev/null +++ b/tools/decrypt.bat @@ -0,0 +1,31 @@ +@echo on +rem Decrypt all files in the input to the output directory. +rem The input directory and the suffixes are defined by +rem constants given below. + +rem Set the input/output directories and the suffixes. +set INDIR=c:\input-files +set OUTDIR=c:\output-files +set INSUFFIX=.gpg +set OUTSUFFIX= +set LOGFILE=%APPDATA%\decrypt.log + +rem No serviceable parts below. + +set GPGARGS=--batch --yes --log-file "%LOGFILE%" --require-compliance +cd %INDIR% +mkdir %OUTDIR% 2>nul +for /R %%f in (*%INSUFFIX%) do ( + setlocal enabledelayedexpansion + for %%i in ("%%f") do ( + set filename=%%~ni + ) + set OUTPATH=%OUTDIR%\!filename!%OUTSUFFIX% + echo Decrypting %%f into !OUTPATH! >> "%LOGFILE%" + gpg %GPGARGS% -o "!OUTPATH!" -d -- "%%f" + if !errorlevel! neq 0 ( + echo Operation failed with return code: %errorlevel% >> "%LOGFILE%" + ) else ( + echo Operation finished successfully >> "%LOGFILE%" + ) +) -- cgit v1.2.3