How to encrypt your folder (using bat file)

In our daily life, we often need to protect some private files and folders to prevent unauthorized access by others. At this time, we can use the method of password-protecting folders to protect our files and folders. This blog will introduce how to make a folder that requires a password to unlock.

Step 1: Create a new folder

First, we need to create a new folder to store the files we need to protect. We can place this folder on the desktop or some other easily accessible location.

Step 2: Change the folder name

Next, we need to change the name of the folder. We can change the name of the folder to something that looks ordinary to avoid drawing attention.

Step 3: Create a .bat file

Before we start creating password protected folders, we need to create a .bat file. We can create this file using Notepad. Open Notepad, and enter the following command:

cls

@ECHO OFF

title Folder Locker

if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK

if NOT EXIST Locker goto MDLOCKER

:CONFIRM

echo Are you sure u want to Lock the folder(Y/N)

set/p "cho=>"

if %cho%==Y goto LOCK

if %cho%==y goto LOCK

if %cho%==n goto END

if %cho%==N goto END

echo Invalid choice.

goto CONFIRM

:LOCK

ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"

attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"

echo Folder locked

goto End

:UNLOCK

echo Enter password to Unlock folder

set/p "pass=>"

if NOT %pass%==password goto FAIL

attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"

ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker

echo Folder Unlocked successfully

goto End

:FAIL

echo Invalid password

goto end

:MDLOCKER

md Locker

echo Locker created successfully

goto End

:End

Copy and paste the above code into Notepad and save the file as "locker.bat".

Step 4: Lock the folder

Now we can start locking the folder down. Double-click the "locker.bat" file and enter "Y" to lock the folder. Now, our folder is locked.

Step 5: Unlock the folder

When we need to access a folder, we need to unlock it. Double-click the "locker.bat" file, and then enter the password we set to unlock the folder.

Summarize:

Through the above steps, we can easily make a folder that requires a password to unlock. This method is not only easy to use, but also provides better security for our private files. It should be noted that we need to keep the password carefully so as not to be stolen by others.

Guess you like

Origin blog.csdn.net/Isaac_Newt0nn/article/details/130896568