Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Secure File/Folder Lock & Unlock (Batch + 7-Zip)

Overview

This batch script allows you to encrypt or decrypt files and folders using 7-Zip.
It supports custom or default passwords and automatically deletes the original after encryption or decryption for security.


Encryption Details

When using:

-p (password)  +  -mhe (encrypt headers)

7-Zip applies:

  • AES-256 encryption
  • CBC (Cipher Block Chaining) mode
  • SHA-256 key derivation from your password

✅ Strong, modern encryption
⚠ Weak passwords (e.g., 1234) can still be brute-forced.
📂 The .7z format is open and can be decrypted with the correct password using any compatible tool.


Example Commands

Encrypt:

7z a -pMySecret123 -mhe locked.7z Secret.txt
  • 7z → Runs 7-Zip
  • a → Add to archive
  • -pMySecret123 → Sets password (replace with your own)
  • -mhe → Encrypts file names
  • locked.7z → Output archive
  • Secret.txt → File to encrypt

Delete original after encrypting:

del Secret.txt

Decrypt:

7z x -pMySecret123 locked.7z

How to Use the Script

  1. Run the .bat file.
  2. Choose an option:
    • 1 → Lock/Encrypt
    • 2 → Unlock/Decrypt
    • 3 → Exit
  3. For encryption:
    • Enter full path to file/folder
    • Specify F (file) or D (folder)
    • Enter a password (leave blank for default)
  4. For decryption:
    • Enter full path to .7z archive
    • Enter password (or leave blank for default)

Notes

  • You must have 7-Zip installed and added to your PATH.
  • The script removes the original after successful encryption/decryption.
  • Encrypted archives can be opened with any tool that supports .7z and the password.

About

A batch script for locking and unlocking files or folders using 7-Zip encryption. Users can enter a custom password or press Enter to use the default. Supports both file and folder encryption with deletion of originals, and secure extraction with password verification.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages