How to protect data without any software? (Part-3) 13

Hello friends, my last two blogs in this category were about How to hide the Folder using Command Prompt, that was done by changing the attributes of the file or the folder. And changing the folder icon to the system icon, using the hex codes of the system folders. This article is to protect the data with the password.

Protect your data with a password:

Many of us install third party software to protect the data with a password. But in this article, we will learn how to protect our data folder with the password using batch files. This is very easy method of locking and hiding folders in Windows without any additional software.

Follow these steps:

1. Open a text file on notepad and save it as lock.bat

2. Add these following lines to the notepad file

 cls

@echo off

title Folder Locker by techfanas

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%==techfanas 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

3.  Save the above code.

4. When you double click or run the Lock.bat file, it will create a new folder named “Locker” automatically, if it is not created. Just copy all the sensitive and important data to this folder.

Loaing Image...

 

5.       If the folder named “Locker” is created and visible, then it will ask to lock the folder.

Loading Image...

The folder named Locker will be locked with the password and invisible.

 

6. To unlock the folder double click on the batch file named lock.bat, it will asked for the password. Enter the password as techfanas and the folder will be visible and unlocked again.

you may change the password, just replace the techfanas with your password in the above code.

Loaing Image...

 

This trick uses both the trick used in my previous articles of this section.

 

Note:

  • The default password for the folder named Locker is “techfanas”. You may change this password to your desired password. Just replace the techfanas in the code of the lock.bat file and save that file.
  • The directory of the batch file and the folder should be same i.e. the batch file and the folder should be in the same directory.
  • Do not put the batch file with the folder after locking it because anyone can unlock it using the batch file and can get your password by editing the batch file. After locking the folder just move the batch file to another location.
  • If you forgot the password in any case, just create another batch file with different password. That will also work well.

 

 

Sachin Kumar

Sachin Kumar
A computer geek who likes windows tweaking, passionate about gadgets, mobile and ethical hacking. Presently pursuing engineering, and likes to dedicate time in web-developing, blogging and gaming.

  • LITTLE

    This is a great trick, but if i am not wrong anyone with such knowledge can get access to the folder by replacing the batch file made by us by one coded by them!

    • Sachin Kumar

      yup…!!!
      thats why, we should not put the folder and the batch file in the same directory… :)

  • vinod

    nice yaar

  • Faid Alfarisi

    Try This . . .

    @ECHO OFF
    COLOR 1F
    MODE 47,6
    TITLE Folder Locker
    SET A=%MyFiles%
    SET B=Control_Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}
    SET C=FF41D262-C2A7-5795-89E4-00805F1408F3
    SET D=FDNME.BIN
    SET E=FDPWD.BIN
    FOR /F “TOKENS=*” %%A IN (%A%%B%%D%) DO SET %%A
    SET FOLDER=%NME%
    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 “%FOLDER%” GOTO CONFIRM0
    IF NOT EXIST “%FOLDER%” GOTO CREATE
    :CREATE
    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 GOTO 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 NOT EXIST “%FOLDERNAME%” MD “%FOLDERNAME%” >NUL
    IF NOT EXIST “%FOLDERNAME%” GOTO UNABLECREATE
    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.NME=%FOLDERNAME%>”%A%%B%%D%”
    IF EXIST “%A%%B%%D%” ATTRIB +H +S +A “%A%%B%%D%” >NUL
    CLS
    ECHO Folder created successfully . . .
    ECHO.
    ECHO Press any key to exit . . .
    PAUSE>NUL
    EXIT
    :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
    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%%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 “%FOLDER%” MOVE “%FOLDER%” “%A%%B%” >NUL
    IF EXIST “%A%%B%%FOLDER%” REN “%A%%B%%FOLDER%” “%C%” >NUL
    IF EXIST “%A%%B%%C%” ATTRIB +H +S +A “%A%%B%%C%” >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 “%FOLDER%” REN “%FOLDER%” “%NEWNAME%”
    IF NOT EXIST “%NEWNAME%” GOTO UNABLERENAME
    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.NME=%NEWNAME%>”%A%%B%%D%”
    IF EXIST “%A%%B%%D%” ATTRIB +H +S +A “%A%%B%%D%” >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
    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%%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.NME=%NEWNAME%>”%A%%B%%D%”
    IF EXIST “%A%%B%%D%” ATTRIB +H +S +A “%A%%B%%D%” >NUL
    CLS
    GOTO UNLOCKING
    :UNABLECREATENAME
    CLS
    ECHO Unable to create folder name . . .
    ECHO.
    ECHO Press any key to exit . . .
    PAUSE>NUL
    EXIT
    :CHANGEPASSWORD1
    TITLE Folder Locker – [CHANGE PASSWORD]
    FOR /F “TOKENS=*” %%A IN (%A%%B%%E%) DO SET %%A
    SET PASS=%PWD%
    CLS
    SET PASSWORD=
    SET /P “PASSWORD=Enter Old Password : ”
    IF NOT DEFINED PASSWORD GOTO CHANGEPASSWORD1
    IF %PASSWORD%==%PASS% GOTO CHANGEPASSWORD2
    ECHO.
    ECHO Invalid Password!!!
    PAUSE>NUL
    GOTO CHANGEPASSWORD1
    :CHANGEPASSWORD2
    CLS
    ECHO Enter Old Password : OK
    ECHO.
    SET NEW=
    SET /P “NEW=Enter New Password : ”
    IF NOT DEFINED NEW GOTO EMPTY1
    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.PWD=%NEW%>”%A%%B%%E%”
    IF EXIST “%A%%B%%E%” ATTRIB +H +S +A “%A%%B%%E%” >NUL
    CLS
    ECHO Password has been changed . . .
    ECHO.
    ECHO Press any key to exit . . .
    PAUSE>NUL
    EXIT
    :NEWPASSWORD
    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%%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.PWD=%NEW%>”%A%%B%%E%”
    IF EXIST “%A%%B%%E%” ATTRIB +H +S +A “%A%%B%%E%” >NUL
    CLS
    ECHO New password has been set . . .
    ECHO.
    ECHO Press any key to exit . . .
    PAUSE>NUL
    EXIT
    :UNLOCKCONFIRM
    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
    FOR /F “TOKENS=*” %%A IN (%A%%B%%E%) DO SET %%A
    SET PASS=%PWD%
    CLS
    ECHO Type “CHANGE” for change your password.
    ECHO.
    SET PASSWORD=
    SET /P “PASSWORD=Enter Password : ”
    IF NOT DEFINED PASSWORD GOTO UNLOCK
    IF %PASSWORD%==%PASS% GOTO UNLOCKING
    IF /I %PASSWORD% EQU CHANGE GOTO CHANGEPASSWORD1
    ECHO.
    ECHO Invalid Password!!!
    PAUSE>NUL
    CLS
    GOTO UNLOCK
    :UNLOCKING
    CLS
    ECHO Please Wait . . .
    IF NOT EXIST “%A%%B%%D%” GOTO CREATENAME
    FOR /F “TOKENS=*” %%A IN (%A%%B%%D%) DO SET %%A
    SET FOLDER=%NME%
    IF EXIST “%FOLDER%” GOTO UNABLEUNLOCK
    IF EXIST “%A%%B%%C%” ATTRIB -H -S -A “%A%%B%%C%” >NUL
    IF EXIST “%A%%B%%C%” REN “%A%%B%%C%” “%FOLDER%” >NUL
    IF EXIST “%A%%B%%FOLDER%” MOVE “%A%%B%%FOLDER%” “.” >NUL
    CLS
    ECHO Folder unlocked successfully . . .
    ECHO.
    ECHO Press any key to exit . . .
    PAUSE>NUL
    EXIT
    :UNABLEUNLOCK
    CLS
    ECHO Unable to unlock folder . . .
    ECHO.
    ECHO Press any key to exit . . .
    PAUSE>NUL
    EXIT

    • Sachin Kumar

      Creating another batch file with different password will also work well…. :)

    • Subham

      yes,this is a good trick…Thank you…

      • Faid Alfarisi

        Okay, but this is my old moding with bored interface, you can visit my blogs at “http://faid-alfarisi.blogspot.com/2012/02/make-your-own-folder-locker-without-any.html”, this a new modding of folder lock with new interface and new password creating mode, is work best on Win7, not only WinXP…

  • Faid Alfarisi

    If you forgot your password, use this . . .

    @ECHO OFF
    COLOR 1F
    MODE 45,8
    TITLE Folder Locker – [PASSWORD RECOVERY]
    SET A=%MyFiles%
    SET B=Control_Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}
    SET C=FDPWD.BIN
    GOTO CONFIRM
    :CHANGEPASSWORD
    CLS
    SET NEW=
    SET /P “NEW=Enter New Password : ”
    IF NOT DEFINED NEW GOTO EMPTY
    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 NOT EXIST “%A%%B%%C%” ECHO.PWD=%NEW%>”%A%%B%%C%”
    IF EXIST “%A%%B%%C%” ATTRIB +H +S +A “%A%%B%%C%” >NUL
    CLS
    ECHO Password changed successfully . . .
    ECHO.
    ECHO Press any key to exit . . .
    PAUSE>NUL
    EXIT
    :CHECK
    CLS
    IF EXIST “%A%%B%%C%” GOTO SUCCESS
    IF NOT EXIST “%A%%B%%C%” GOTO NOTFOUND
    :CONFIRM
    CLS
    ECHO Are you sure want to recover password [Y/N]?
    ECHO.
    SET /P “CHOICE=¯ ”
    IF NOT DEFINED CHOICE GOTO CONFIRM
    IF /I %CHOICE% EQU Y GOTO CHECK
    IF /I %CHOICE% EQU N EXIT
    ECHO.
    ECHO Invalid Input!!!
    PAUSE>NUL
    CLS
    GOTO CONFIRM
    :CONTINUE
    CLS
    SET CHOICE=
    ECHO 1. Change Password
    ECHO 2. Delete Password
    ECHO 3. Exit
    ECHO.
    SET /P “CHOICE=Your Choice : ”
    IF NOT DEFINED CHOICE GOTO CONTINUE
    IF /I %CHOICE% EQU 1 GOTO CHANGEPASSWORD
    IF /I %CHOICE% EQU 2 GOTO DELETEPASSWORD
    IF /I %CHOICE% EQU 3 EXIT
    ECHO.
    ECHO Invalid Choice!!!
    PAUSE>NUL
    CLS
    GOTO CONTINUE :D ELETEPASSWORD
    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
    CLS
    ECHO Password deleted successfully . . .
    ECHO.
    ECHO Press any key to exit . . .
    PAUSE>NUL
    EXIT
    :EMPTY
    ECHO.
    ECHO Empty Password!!!
    PAUSE>NUL
    GOTO CHANGEPASSWORD
    :NOTFOUND
    ECHO Can’t find “Folder Locker” password . . .
    ECHO.
    ECHO.
    ECHO.Recovery is uncompleted . . .
    ECHO.
    ECHO.
    ECHO Press any key to exit . . .
    PAUSE>NUL
    EXIT
    :SUCCESS
    FOR /F “TOKENS=*” %%A IN (%A%%B%%C%) DO SET %%A
    SET PASSWORD=%PWD%
    ECHO Recovery completed successfully . . .
    ECHO.
    ECHO.
    ECHO.Your Password Is : %PASSWORD%
    ECHO.
    ECHO.
    ECHO Press any key to continue . . .
    PAUSE>NUL
    GOTO CONTINUE

    • Sachin Kumar

      Creating another batch file with different password will also work well…. :)

    • Sachin Kumar

      Creating another batch file with different password will also work well…. :)

  • Subham Agrawal

    no,your third trick is not working.only 5 steps are working properly.
    Means to say:when i press “Y” to lock the folder “Locker”, it creates a file with a ununderstood name “o”.The folder named Locker does not lock with the password and does not invisible……pls solve my problem,becouse any software of folder lock does not work in window 7.
    my email address is agrawals92@gmail.com

  • Lawyermasfi

    hey i am facing prob. after creating the private file, i clicked the batch file. and then typed y. the private folder didnt got disappeared. a little file name: ö got created.