A PowerShell-based automation tool for batch encrypting and decrypting Excel & Word files. Supports custom password logic and simultaneous batch processing.
2025-12-20.00-56-57.mp4
- High Efficiency: Process a large number of files at once when they share the same encryption or decryption password.
- Simultaneous Processing: Supports running encryption and decryption tasks at the same time.
- Custom Keys: Prioritizes custom
.txtpassword files; automatically falls back to the default password (Kpmg123) if missing. - Group Key Logic: Separate keys can be set for encryption and decryption tasks.
- Format Support: Compatible with Excel (.xlsx, .xlsm, .xls) and Word (.docx, .doc).
- Anti-Hanging Protection: Double-detection (empty password test) during file opening to prevent Office authentication pop-ups from freezing the automation.
- Resource Optimization: Integrated
Marshal.ReleaseComObjectand .NET Garbage Collection to ensure no residual processes after heavy batch processing. - Security & Safety: Auto-detects and removes Read-Only attributes, and implements a fallback mechanism for
SaveAs2failures.
- Place files into the corresponding folders.
- Run
run.batto start batch processing. A summary will be displayed upon completion.
.Office-Batch-Cryptor
├── AutoEncryptDecrypt.ps1 # Core automation logic
├── run.bat # Quick start batch file
├── input_to_encrypt/ # Path for files to be encrypted
├── input_to_decrypt/ # Path for files to be decrypted
├── encrypt_password.txt # (Optional) Custom encryption password; defaults if empty
└── decrypt_password.txt # (Optional) Custom decryption password; defaults if empty