Password Protect Folder Without Using Any Software in Windows
It is very important to hide the confidential data in Windows. Some time the data which are really private need to be secured from the third-party. We have already discussed about the data hiding and file security in previous articles. But this one can take your data protection to a whole new level, a more secured one.
Tip: Secure the folder containing private data without any password protection software.
We shall make a folder locked making password protected also hidden, so that any third-party can not access its contents. There are tons of software, available in the market to hide or lock your folder in Windows. But if some thing can be done without the help of a software then why should you use one? In this article, I’ve described the whole process to lock the folder by creating a simple Batch file.
How to create the batch file to lock a folder
1. Copy and paste the following codes in a notepad file.
cls @ECHO OFF title Folder Confidential if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK if NOT EXIST Confidential goto MDLOCKER :CONFIRM echo Are you sure you 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 Confidential "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 the Password to unlock folder set/p "pass=>" if NOT %pass%== Replace this red portion by Your password goto FAIL attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Confidential echo Folder Unlocked successfully goto End :FAIL echo Invalid password goto end :MDLOCKER md confidential echo Confidential created successfully goto End :End [Download the text version of the code] [via Trap17.com]
2. Save the file as “Key.bat”. You are done. When you’ll double-click on the Key.bat file for first time, a folder “Confidential” will be automatically created. You can move all your confidential data in that folder.

Now to lock the folder just double click on the file “Key”. You will get a confirmation message in Command Prompt. Type “y” to confirm. Now the folder “Confidential” will be locked and hidden.

If you want to get access to the contents of the folder then again double-click on the batch file, you have created. Immediately you will be prompted to enter your password. After that you can get access to the folder “Confidential”.

By this process you can password protect the folder and no body can get access to the folder without the password. But still there is some risk. If some body is a computer savvy then he can easily retrieve the password from your batch file. He can easily find the password by choosing “Edit” option from the right-click context menu.
So, to prevent from that option you can make an executable file of the batch file. The facility of the executable file is that no body can’t see the source code of an exe file. Here I’ve described the process of converting the batch file to executable(.exe) file.
At first you need a compiler that compiles the batch file to an executable file.
1. Download Bat to Exe converter
2. Now run the application and put the source path of the batch file, then the target executable file name with location.

3. Click on “Compile” button.
That’s all. Delete the batch file “key.bat”. You can now protect or access the folder by using the exe file (key.exe). Your data is now fully protected.
The above method works in XP, Vista and Windows 7.
Update: After getting some feedback from the reader we modified the code and it should work properly. You can also get the code by clicking on the text version link.
While password protecting a folder ensures the security of important data, password protect images to make them private and inaccessible.





Reader Comments
Nice one. takes no load too
@NavaPavan
This is for that I hate to use software for some cases.
it doesn’t works with win7
@alok
This definitely works in Windows 7. You can see that all the screen shots are given from Windows 7. I have tested it in Windows 7 and works fine. You can repeat the process very carefully.
this is not working in window XP….
Why its not working in XP??
It’s nothing like protection, it makes the folder as system hidden, which can be accessed easily.
This one work in XP..can I repost this blog in my site?
http://bernadettediaries.blogspot.com
Thanks.
cls
@ECHO OFF
title Folder Confidential
if EXIST \"Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}\" goto UNLOCK
if NOT EXIST Confidential goto MDLOCKER
:CONFIRM
echo Are you sure you 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 Confidential \"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 \"cho=>\"
if NOT %cho%== Replace this red portion by your Password goto FAIL
attrib -h -s \"Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}\"
ren \"Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}\" Confidential
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Confidential
echo Confidential created successfully
goto End
:End
It does not work well in windows 7.
If you go to options and uncheck the option of protected system files.The folder will appear.
Please help.
@WAQAR: It works fine in Windows 7. Please take a look at the screen shots.
tnx……dude
it helped a lot ………
the new one works well in XP
very good explanation
Welcome! Pulkit..
But there is a big problem.
Anybody who know this method when made a .bat file like this and use any password can open this private file.
For example i made a private folder and my password is 123 and private file unvisible.
and then i delete this .bat file which was password is 123, and i create new one and password is nonpasaran.
password “nonpasaran” can open the file which locked password 123 !
Any idea?
Thank you very much.
Excllent Piece of code. Thanks for sharing :)
this would protect your files from people with average computer knowlage :D. thanks.
It does not work with xp.
Hi, i have tried this method in windows 7. However this code does not work at all you should recheck your code. But the code in source which you wrote. http://www.knowledgesutra.com/forums/topic/55662-best-way-to-lock-a-folder-without-using-an-application/
this worked well.
By the way this is not secure. Open tools then folder options and select tab “View”. Then Uncheck: “Hide protected operating system files”. And you can freely and easily open that secured folder (however it is named something like “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”)
So this is just a trick.
Great job man
It does work with Windows XP
Dude you really fail. I’m still able to access the file. You are just simply making it hidden.
Adi: You might not able to follow the instruction properly.
Hey dude the key.bat file is not workin properly…..my password is not workin. Can u plz tell me how to unlock it?….plzzzzzzzzzzzz
my password is not workin. Can u plz tell me how to unlock it?….plzzzzzzzzzzzz
it doesn’t works with win7.
When i click on ‘Key’ then command says “123 to unlock” but in your image it shows “Enter the password to unlock”
And what to do if anyone Delete the icon “Key”
@Akash: Sorry for the mistake. I have made the correction. Now it should work fine. Thanks for your feedback.
Though you can recreate that unlocking key by the above codes. And if you can remember the password, you will be able to recover that folder. But keep that key file in such a place that any one can’t find that easily.
key.bat is not craeting the req. folder “confidential”.Kindly tell where it is created.
@Bhupi: Copy the code by clicking the “Download the text version” link at the above post. It should work.
Amazing really amazing site!…i should go through every tips of this site to be genius hahaha!
Hi! My question is how to delete this .bat file completely and what if someone deletes the converted .exe too I mean then how will I get my stuffs back.
If your folder is unlocked then just manually delete the file from its location by pressing the Delete button.
For you second query: If you can remember the password then you can again create that bat file or exe file from this site and follow the procedure of unlocking.
Yes, but I wanted to know whether or not the stuffs on the Confidential Folder will remain there or not
i will try this at my home to protect my folders for the first time
thanks a,it woks well……
after selecting yes option d folder doesn’t bcome invisible ……. rather a shortcut to control panel is created …….. can any one help me?
Hi dude,
Concept was good but you need to work more to avoid deletion of folder once it will locked
@Shardul: Thanks for the suggestion.
it’s not working on window 7….in hidden files confedential folder is visible……….
Works perfectly fine with win7. however, by going to organize-folder and search options-view, then hitting hide protected system files, the file can be revealed…
Thanks ,worked like a charm on my windows7…
I made everything the way it says, I followed it step by step, and it works, but why is it that when I click to unlock the folder, where that little pop up appears about inserting the password, it doesnt ask me that, instead it GIVES me my password and all you have to do is press “y” and enter and it opens the folder.. Help me please??
It works so well in windows xp
Thanks Tanmay
I finished all the steps (1..2..3.) then I put my files inside the Confidential folder, then i converted bat to exe, but when i opened key.bat and key.exe by password my files are missing.
Please someone help me to get my folder back!
I have a question, how to prevent any1 from deleting the file (key) plz if anyone knows how , i would be very grateful thx…
can you change the folder name from confidential to something else???
Yes Ali. Just replace the word confidential in the code with your desired name (make sure you replaced all)
Nice easy and requires no software. But if someone delete this key file folder is lost, right? I tested it and i couldn`t reach this cofidential folder anymore after deleted hey file
can I rename “Confidential” to anything I want? ‘Cause there are 2 that I need to lock.
sorry. I know the answer. thanks.
WORKS PERFECLY ON ANY WINDOWS! TESTED BY ME ON WINDOWS 2000, XP SP3, VISTA 64 BIT AND WINDOWS 7 32 BIT! THANK YOU VERY MUCH!
works well on win 7,at first it didnt,one juz gotta do steps as outlined.
still to check whether it is compromisable though
good one!thankx for ur post
the folder that is locked, can be deleted by any body without asking password
can u give me any suggessions
this is very nice folderlock thankyou verymuch. but anybody will delete the key.bat. so, i think this code is very fine if it is when undeletable file (key.bat)
Other than that, for a ‘no software required’ protection, it is a very good solution.
Yes, it can be gotten around, but by it being hidden, the folder is less likely to pique someone’s curiosity to try and see what is in it.
it doesn’t work wid windows xp.
confidential folder opens on any password.
in windows 7 folder is created
but it gets opened even without password
hey guys….any idea ..how we can protect external USB hard drive data…i hav tried few softwares..but either they all are not working properly or the became trial versions…and hav limited use like 3-5 times.anybody hav USB secure with crack….working…pls do let me know guys..it will b great help…take care
the confidential can be seen without passwords.. waste of time..
nice, its really worked for me on windows 7 ultimate.
yes its working good then other
Windows 7 Ultimate SP1 Here. It works perfectly on my PC. Thanks for sharing this tip: How to Password Protect Folder in Windows. More power!
i need some code for exe file protection….
Thks buddy.
Nice and easy but when one search the folder displays itself which should not.
hi TANMAY UR IDEA WORKS FOR ME IN WIN XP.THANKS:) BUT MY QUESTION IS THEIR ANYWAY TO CHANGE PASSWORD THROUGH MS-DOS COMMAND WITHOUT EDITING CODING PROGRAM.THANKS MADDY
TANMAY I READ THIS ARTICLE IN MANY SITES BUT I WAS UNABLE TO UNDERSTAND BUT AS OF NOW IAM FINE AS DUE HAVE ILLUSTRATED IN SUCH A SIMPLE AND GOOD MANNER…THUMPS UP FOR U KEEP IT UP
@Maddy: Thanks for your appreciation. Will try to integrate that feature so that the password can be changed with a dos command. Keep coming.
U rock thanks
we have done it befor but with the help of software.
HAI .CONCEPT IS GOOD AND VERY USE FULL ..BUT IT IS NOT WORKING GOOD .. I TRY THIS PROCEDURE IN WIN 7..ONE PROBLEM IS OCCURED .. THE CONFIDENTIOL FOLDER IS NOT APEAR .IN DOUBLE CLIK OF BAT FILE ..HOW SOLVE THIS PROBLEM???TELL ME SOLUTION IN MY MAIL SAT143@YMAIL.COM
Satish, In windows 7, you need to run the command as an admin for the changes to be made
but why i click wrong pass the folder or file can still opened….???
how do i retrive the folder i locked ?
as i m not getting Confidential folder after double click key.bat.
i have recently formatted my computer.
plz help me getting this folder
If we hide a file lets say sam.jpg, it wont show up.
But if we search sam.jpg, file is found even if its hidden.
lol
this tip is for kids and stupids.
i can unlock it even without password.
i accidentally deleted the folder where i hidden the folder..how do i retrieve it?
i lock the folder what is the password for unlock the folder. i do not change anything in the bat file
Yeah this look good, but as i heard in above comment that it’s still appear even if it is in hidden, if it’s in search it shows the folder over there. so hw to disappear form that is there is ny thing which the folder should be there and it should asked for password
I want your best comments in my e-mail.
Hi It works good, but after I attach and send this file through the outlook email to other person, it goes to unlock. After that, the file retains in unlocked condition. How can we lock the file, after it is attached through email?
dear, but when the .bat file asks for password, even if i enter any incorrect password th3e folder gets disclosed, is thr some mistake in the code, or some other trick will do
Hi tanmay,
the key file will unlock the confidential with wrong password also.
Hi Tanmay. Doll is right. key.exe-file unlocks the Confidential with ANY password!
when it asks for the password and whatever I put it unlocks
here is an simpler program that i am working on can you give me some advice about it???
@echo off
:start
taskkill /f /im “explorer.exe”
cls
set /p Answer= Please enter password
if /i {%ANSWER%}=={YOUR PASSWORD HERE} (goto :yes)
goto :start
:yes
START explorer
cls
echo correct password
pause
Good .. Thanks a lot !
But the key file will unlock the confidential with wrong password also.
Please Help.. Reply on My Email. ID : s43prakash@gmail.com
thanks it worked…. but while typing password it is visible…can you make it like ****** way
Try my edited version :
- Save/Load password.
- Can open folder in anywhere in same drive.
- Rename folder
@ECHO OFF
COLOR 1F
MODE 47,6
TITLE Folder Locker
SET A=%MyFiles%
SET B=C2F41D69-E2A7-5795-89E4-00805FE4081D
SET C=D4E221D2-3A5B-1069-52DD-06002B3A3098
SET D=E65D24D8-98B5-68C0-BB82-010D30BDCE0C
SET E=F89CDCE2-B7C3-28FF-A9F0-007A0060FC34
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:F /E >NUL
IF EXIST “%A%%B%” ATTRIB +H +S +A “%A%%B%” >NUL
IF EXIST “%A%%B%%D%” CACLS “%A%%B%%D%” /P EVERYONE:F /E >NUL
IF EXIST “%A%%B%%E%” CACLS “%A%%B%%E%” /P EVERYONE:F /E >NUL
IF EXIST “%A%%B%%D%” FOR /F “TOKENS=*” %%F IN (%A%%B%%D%) DO SET “FD=%%F”
IF EXIST “%A%%B%%E%” FOR /F “TOKENS=*” %%P IN (%A%%B%%E%) DO SET “PS=%%P”
IF EXIST “%A%%B%%D%” CACLS “%A%%B%%D%” /P EVERYONE:N /E >NUL
IF EXIST “%A%%B%%E%” CACLS “%A%%B%%E%” /P EVERYONE:N /E >NUL
IF EXIST “%A%%B%%C%” GOTO CONFIRM0
IF NOT EXIST “%A%%B%%C%” GOTO CONFIRM2
:CONFIRM0
IF EXIST “%A%%B%%E%” GOTO CONFIRM1
IF NOT EXIST “%A%%B%%E%” GOTO NEWPASSWORD
:CONFIRM1
IF EXIST “%A%%B%%C%” GOTO UNLOCKCONFIRM
IF NOT EXIST “%A%%B%%C%” GOTO LOCKCONFIRM
:CONFIRM2
IF EXIST “%FD%” GOTO CONFIRM0
IF NOT EXIST “%FD%” GOTO CREATE
:CREATE
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:N /E >NUL
TITLE Folder Locker – [CREATE FOLDER]
CLS
ECHO Are you sure want to make new folder [Y/N]?
ECHO.
SET /P “CHOICE=> ”
IF NOT DEFINED CHOICE GOTO CREATE
IF /I “%CHOICE%” EQU “Y” GOTO CREATEFOLDERNAME
IF /I “%CHOICE%” EQU “N” EXIT
ECHO.
ECHO Invalid Choice!!!
PAUSE>NUL
CLS
GOTO CREATE
:CREATEFOLDERNAME
CLS
ECHO Type name for your new folder.
ECHO.
SET /P “FOLDERNAME=> ”
IF NOT DEFINED FOLDERNAME GOTO EMPTY4
GOTO CREATING
:CREATING
CLS
ECHO Please Wait . . .
IF NOT EXIST “%A%%B%” MD “%A%%B%” >NUL
IF EXIST “%A%%B%” ATTRIB +H +S +A “%A%%B%” >NUL
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:N /E >NUL
IF NOT EXIST “%FOLDERNAME%” MD “%FOLDERNAME%” >NUL
IF NOT EXIST “%FOLDERNAME%” GOTO UNABLECREATE
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:F /E >NUL
IF EXIST “%A%%B%%D%” CACLS “%A%%B%%D%” /P EVERYONE:F /E >NUL
IF EXIST “%A%%B%%D%” ATTRIB -H -S -A “%A%%B%%D%” >NUL
IF EXIST “%A%%B%%D%” ECHO Y|DEL “%A%%B%%D%” >NUL
IF EXIST “%FOLDERNAME%” ECHO.%FOLDERNAME%>”%A%%B%%D%”
IF EXIST “%A%%B%%D%” ATTRIB +H +S +A “%A%%B%%D%” >NUL
IF EXIST “%A%%B%%D%” CACLS “%A%%B%%D%” /P EVERYONE:N /E >NUL
IF NOT EXIST “%A%%B%%E%” GOTO SETPASS
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:N /E >NUL
CLS
ECHO Folder created successfully . . .
ECHO.
ECHO Press any key to exit . . .
PAUSE>NUL
EXIT
:SETPASS
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:N /E >NUL
CLS
ECHO Folder created successfully . . .
ECHO.
ECHO Press any key to set password . . .
PAUSE>NUL
GOTO NEWPASSWORD
:UNABLECREATE
CLS
ECHO Unable to create folder . . .
ECHO.
ECHO Press any key to exit . . .
PAUSE>NUL
EXIT
:EMPTY1
ECHO.
ECHO Empty Password!!!
PAUSE>NUL
GOTO CHANGEPASSWORD2
:EMPTY2
ECHO.
ECHO Empty Password!!!
PAUSE>NUL
GOTO NEWPASSWORD
:EMPTY3
ECHO.
ECHO Empty Name!!!
PAUSE>NUL
GOTO RENAME
:EMPTY4
ECHO.
ECHO Empty Name!!!
PAUSE>NUL
GOTO CREATEFOLDERNAME
:EMPTY5
ECHO.
ECHO Empty Name!!!
PAUSE>NUL
GOTO CREATENAME
:LOCKCONFIRM
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:N /E >NUL
TITLE Folder Locker – [LOCK FOLDER]
CLS
ECHO Type “RENAME” for rename your current folder.
ECHO Type “CHANGE” for change your password.
ECHO Are you sure want to lock your folder [Y/N]?
ECHO.
SET /P “CHOICE=> ”
IF NOT DEFINED CHOICE GOTO LOCKCONFIRM
IF /I “%CHOICE%” EQU “Y” GOTO LOCKING
IF /I “%CHOICE%” EQU “N” EXIT
IF /I “%CHOICE%” EQU “CHANGE” GOTO CHANGEPASSWORD1
IF /I “%CHOICE%” EQU “RENAME” GOTO RENAME
SET /P CHOICE=Invalid Choice!!!
CLS
GOTO LOCKCONFIRM
:LOCKING
CLS
ECHO Please Wait . . .
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:F /E >NUL
IF EXIST “%A%%B%%C%” CACLS “%A%%B%%C%” /P EVERYONE:F /E >NUL
IF EXIST “%A%%B%%C%” ATTRIB -H -S -A “%A%%B%%C%” >NUL
IF EXIST “%A%%B%%C%*” ATTRIB -H -S -A “%A%%B%%C%*” >NUL
IF EXIST “%A%%B%%C%*” ECHO Y|DEL “%A%%B%%C%*” >NUL
IF EXIST “%A%%B%%C%” RD “%A%%B%%C%” >NUL
IF EXIST “%FD%” MOVE “%FD%” “%A%%B%” >NUL
IF EXIST “%A%%B%%FD%” REN “%A%%B%%FD%” “%C%” >NUL
IF EXIST “%A%%B%%C%” ATTRIB +H +S +A “%A%%B%%C%” >NUL
IF EXIST “%A%%B%%C%” CACLS “%A%%B%%C%” /P EVERYONE:N /E >NUL
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:N /E >NUL
CLS
ECHO Folder locked successfully . . .
ECHO.
ECHO Press any key to exit . . .
PAUSE>NUL
EXIT
:RENAME
TITLE Folder Locker – [RENAME FOLDER]
CLS
ECHO Type new name for your current folder.
ECHO.
SET /P “NEWNAME=> ”
IF NOT DEFINED NEWNAME GOTO EMPTY3
IF EXIST “%FD%” REN “%FD%” “%NEWNAME%”
IF NOT EXIST “%NEWNAME%” GOTO UNABLERENAME
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:F /E >NUL
IF EXIST “%A%%B%%D%” CACLS “%A%%B%%D%” /P EVERYONE:F /E >NUL
IF EXIST “%A%%B%%D%” ATTRIB -H -S -A “%A%%B%%D%” >NUL
IF EXIST “%A%%B%%D%” ECHO Y|DEL “%A%%B%%D%” >NUL
IF NOT EXIST “%A%%B%%D%” ECHO.%NEWNAME%>”%A%%B%%D%”
IF EXIST “%A%%B%%D%” ATTRIB +H +S +A “%A%%B%%D%” >NUL
IF EXIST “%A%%B%%D%” CACLS “%A%%B%%D%” /P EVERYONE:N /E >NUL
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:N /E >NUL
CLS
ECHO Folder renamed successfully . . .
ECHO.
ECHO Press any key to exit . . .
PAUSE>NUL
EXIT
:UNABLERENAME
CLS
ECHO Unable to rename folder . . .
ECHO.
ECHO Press any key to exit . . .
PAUSE>NUL
EXIT
:CREATENAME
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:N /E >NUL
TITLE Folder Locker – [CREATE NAME]
CLS
ECHO Folder name is not set, type new folder name.
ECHO.
SET /P “NEWNAME=> ”
IF NOT DEFINED NEWNAME GOTO EMPTY5
IF NOT EXIST “%NEWNAME%” MD “%NEWNAME%” >NUL
IF NOT EXIST “%NEWNAME%” GOTO UNABLECREATENAME
IF EXIST “%NEWNAME%” RD “%NEWNAME%” >NUL
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:F /E >NUL
IF EXIST “%A%%B%%D%” CACLS “%A%%B%%D%” /P EVERYONE:F /E >NUL
IF EXIST “%A%%B%%D%” ATTRIB -H -S -A “%A%%B%%D%” >NUL
IF EXIST “%A%%B%%D%” ECHO Y|DEL “%A%%B%%D%” >NUL
IF NOT EXIST “%A%%B%%D%” ECHO.%NEWNAME%>”%A%%B%%D%”
IF EXIST “%A%%B%%D%” ATTRIB +H +S +A “%A%%B%%D%” >NUL
IF EXIST “%A%%B%%D%” CACLS “%A%%B%%D%” /P EVERYONE:N /E >NUL
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:N /E >NUL
CLS
GOTO UNLOCKING
:UNABLECREATENAME
CLS
ECHO Unable to create folder name . . .
ECHO.
ECHO Press any key to exit . . .
PAUSE>NUL
EXIT
:CHANGEPASSWORD1
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:N /E >NUL
TITLE Folder Locker – [CHANGE PASSWORD]
CLS
SET PASSWORD=
SET /P “PASSWORD=Enter Old Password : ”
IF NOT DEFINED PASSWORD GOTO CHANGEPASSWORD1
IF “%PASSWORD%”==”%PS%” GOTO CHANGEPASSWORD2
ECHO.
ECHO Invalid Password!!!
PAUSE>NUL
GOTO CHANGEPASSWORD1
:CHANGEPASSWORD2
CLS
ECHO Enter Old Password : %PS%
ECHO.
SET NEW=
SET /P “NEW=Enter New Password : ”
IF NOT DEFINED NEW GOTO EMPTY1
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:F /E >NUL
IF EXIST “%A%%B%%E%” CACLS “%A%%B%%E%” /P EVERYONE:F /E >NUL
IF EXIST “%A%%B%%E%” ATTRIB -H -S -A “%A%%B%%E%” >NUL
IF EXIST “%A%%B%%E%” ECHO Y|DEL “%A%%B%%E%” >NUL
IF NOT EXIST “%A%%B%%E%” ECHO.%NEW%>”%A%%B%%E%”
IF EXIST “%A%%B%%E%” ATTRIB +H +S +A “%A%%B%%E%” >NUL
IF EXIST “%A%%B%%E%” CACLS “%A%%B%%E%” /P EVERYONE:N /E >NUL
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:N /E >NUL
CLS
ECHO Password has been changed . . .
ECHO.
ECHO Press any key to exit . . .
PAUSE>NUL
EXIT
:NEWPASSWORD
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:N /E >NUL
TITLE Folder Locker – [NEW PASSWORD]
CLS
SET NEW=
ECHO Password is not set, type new password.
ECHO.
SET /P “NEW=New Password : ”
IF NOT DEFINED NEW GOTO EMPTY2
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:F /E >NUL
IF EXIST “%A%%B%%E%” CACLS “%A%%B%%E%” /P EVERYONE:F /E >NUL
IF EXIST “%A%%B%%E%” ATTRIB -H -S -A “%A%%B%%E%” >NUL
IF EXIST “%A%%B%%E%” ECHO Y|DEL “%A%%B%%E%” >NUL
IF NOT EXIST “%A%%B%%E%” ECHO.%NEW%>”%A%%B%%E%”
IF EXIST “%A%%B%%E%” ATTRIB +H +S +A “%A%%B%%E%” >NUL
IF EXIST “%A%%B%%E%” CACLS “%A%%B%%E%” /P EVERYONE:N /E >NUL
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:N /E >NUL
CLS
ECHO New password has been set . . .
ECHO.
ECHO Press any key to exit . . .
PAUSE>NUL
EXIT
:UNLOCKCONFIRM
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:N /E >NUL
TITLE Folder Locker – [UNLOCK FOLDER]
CLS
ECHO Are you sure want to unlock your folder [Y/N]?
ECHO.
SET /P “CHOICE=> ”
IF NOT DEFINED CHOICE GOTO UNLOCKCONFIRM
IF /I “%CHOICE%” EQU “Y” GOTO UNLOCK
IF /I “%CHOICE%” EQU “N” EXIT
ECHO.
ECHO Invalid Choice!!!
PAUSE>NUL
CLS
GOTO UNLOCKCONFIRM
:UNLOCK
CLS
ECHO Type “CHANGE” for change your password.
ECHO.
SET /P “PASSWORD=Enter Password : ”
IF NOT DEFINED PASSWORD GOTO UNLOCK
IF “%PASSWORD%”==”%PS%” GOTO UNLOCKING
IF /I “%PASSWORD%” EQU “CHANGE” GOTO CHANGEPASSWORD1
ECHO.
ECHO Invalid Password!!!
PAUSE>NUL
CLS
GOTO UNLOCK
:UNLOCKING
CLS
ECHO Please Wait . . .
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:F /E >NUL
IF EXIST “%A%%B%%C%” CACLS “%A%%B%%C%” /P EVERYONE:F /E >NUL
IF NOT EXIST “%A%%B%%D%” GOTO CREATENAME
IF EXIST “%A%%B%%D%” CACLS “%A%%B%%D%” /P EVERYONE:F /E >NUL
IF EXIST “%A%%B%%D%” FOR /F “TOKENS=*” %%F IN (%A%%B%%D%) DO SET “FD=%%F”
IF EXIST “%A%%B%%D%” CACLS “%A%%B%%D%” /P EVERYONE:N /E >NUL
IF EXIST “%FD%” GOTO UNABLEUNLOCK
IF EXIST “%A%%B%%C%” ATTRIB -H -S -A “%A%%B%%C%” >NUL
IF EXIST “%A%%B%%C%” REN “%A%%B%%C%” “%FD%” >NUL
IF EXIST “%A%%B%%FD%” MOVE “%A%%B%%FD%” “.” >NUL
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:N /E >NUL
CLS
ECHO Folder unlocked successfully . . .
ECHO.
ECHO Press any key to exit . . .
PAUSE>NUL
EXIT
:UNABLEUNLOCK
IF EXIST “%A%%B%%C%” CACLS “%A%%B%%C%” /P EVERYONE:N /E >NUL
IF EXIST “%A%%B%” CACLS “%A%%B%” /P EVERYONE:N /E >NUL
CLS
ECHO Unable to unlock folder . . .
ECHO.
ECHO Press any key to exit . . .
PAUSE>NUL
EXIT