BAT: Szyfrowane backupy za pomocą 7z i batcha

@echo off setlocal enabledelayedexpansion REM Set the source and destination directories set "sourceDir=A:\" set "destinationDir=B:\" REM Get the current date in the format DD.MM.YYYY for /f "tokens=1-3 delims=." %%a in ('echo %date%') do ( set "currentDate=%%a.%%b.%%c" ) REM Set the password for encryption set "password=PUT PASSWORD HERE" REM Set the output file name with the current date set "outputFileName=backup_%currentDate%.zip" REM Create the ZIP archive with encryption 7z a -tzip -p"%password%" "%destinationDir%\%outputFileName%" "%sourceDir%\*" REM Check if the ZIP operation was successful if %errorlevel% equ 0 ( echo Archive creation successful. REM Optional: Delete the original files in the source directory REM del /q "%sourceDir%\*" REM Optional: Move the encrypted archive to the destination directory move /y "%outputFileName%" "%destinationDir%\" echo Move successful. ) else ( echo Archive creation failed. ) endlocal