Tech Hacks, News and Tutorials

How to Lock a Folder with a Password in Windows

After writing about hiding and lock the folder on the laptop Windows. Next, we will discuss specific ways to be able to lock a folder with a password in Windows.

The following methods do not require assistance from other software or additional applications. This method is purely from making folder key code with a batch file which we will then use to hide our important folders.

Read also how to lock folders with encryption and how to lock folders with software. To find out how to completely hide and lock a folder with a password, please read tutorial below.

How to Lock a Folder with a Password – I tried it this way in Windows 10 and haven’t tried it in previous versions of Windows. Here’s how to lock the Windows folder using only a password:

  1. Preparation: Open the directory location of the folder that you want to lock.
  2. Search for the location of the folder to lock: Open the folder and right-click in the folder you want to lock. You can even lock folders located on your laptop’s desktop.
  3. Create a file for the folder lock command: Next, create a file to create a folder lock command, it can be with regular Notepad or Noteped ++. How to Right-click on an empty area in the folder you want to lock then select New> Text Document. Then open the .txt file that you created earlier and paste the code that I have prepared below.
    title Folder Locker
    if EXIST "Control Panel. {21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
    if NOT EXIST locker goto MDLOCKER
    echo Are you sure you want to lock this 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 the password to unlock the folder
    set / p "
    if NOT% pass% == Password-You 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
    md Locker
    echo Locker created successfully
    goto End
    : End
  4. Enter the password you want: The next step is to set a password to lock the important folder. Look for your password-writing in the code that you copied earlier into Notepad (see picture below). And change the password you want. For example: 1234567890 or Handsome.
  5. Save and convert to batch format: After that save the file with a batch file format (. Bat). You do this by clicking File> Save As then change the name to FolderLocker.bat and change the format .txt to format .bat.
  6. Prepare key folders and important files: If already saved becomes FolderLocker.bat and then double-click on the file and a new folder will be formed with the name locker.
  7. Enter important files in the Locker folder: Fill in the folder locker with the files and folders that you want to lock. Drag or Copy into a folder locker.
  8. Folder lock process: After that, lock the Locker folder by clicking the batch file again Folder Locker and a command prompt will open with the contents Are you sure you want to lock this folder? (Y / N) and type in Y to lock the folder. The command prompt will close automatically and the Locker folder will also disappear from your directory.
  9. How to access locked files/folders again: To access the saved file, click the file Folder Locker again and you will be asked to type the password you have filled in step 4 previous. And the locked folder will automatically be in the same directory.
  10. D1. That’s how to lock a folder with a password.

Advantages of Locking a Folder with a Password

Of course, this method has advantages and disadvantages. What are the advantages that you can get from how to hide a folder with a password? Here are the main points:

  • No software needed: What I like about this method is to hide important files and folders on the laptop, there is no need to install additional software. Thus, laptop storage is more relieved and not full of software. It only requires a file editor, in this case, Notepad which is Windows default software.
  • Only copy and paste the code: The only capital needed is to copy the code that I have provided above. So this method is quite effective for those of you who are lazy coding to make the folder lock command.
  • Easy and fast: This method is perfect for you who do not want to be complicated. The time needed is also quite fast and certainly easy.
  • Can be done by anyone: How to lock a folder with a password can be done by any1. Including you who can’t coding.
  • The password is different for each folder: Another advantage of this method is that you can specify a different password for each folder that you will lock. For security, just use one or two different passwords.

Disadvantages of Locking a Folder with a Password

After knowing what are the advantages of how to lock a folder with a password. You also have to know what are the shortcomings of this method. Here are the shortcomings of how to lock a Windows folder with a password:

  • Must record a password: If you make a lot of folders in each of the other important directories and create different passwords, then you must record the password so that it is not forgotten.
  • People can know the password: This is the most important, if you use this method to hide your important folders, then people who are experienced can find out your folder password. To prevent this you can hidden FolderLocker.bat file in a way right click on the FolderLocker.bat file then choose Properties> General> Hidden. Then the file will be hidden. To access again, open File Explorer and select the File menu> View> look for the Hidden files and folders option> check Show hidden files, folders, and drives.