Facebook PixelHow to Password Protect a Folder in Windows 10 Without Any Additional Software | Blog | CodeWithHarry
How to Password Protect a Folder in Windows 10 Without Any Additional Software

How to Password Protect a Folder in Windows 10 Without Any Additional Software

"Follow the steps given below to lock a folder or file without any additional software in Windows ..."

By CodeWithHarry

Updated: 5 April 2025

In this article, I will tell you a trick that will help you lock and hide any folder without installing any third-party software. With just a simple .bat file, you can protect your folders easily. Whenever you want to open the protected folder, a password will be required before the folder becomes visible and accessible. So, without further delay, follow the steps given below to password protect a folder:

  1. First of all, open the folder you want to secure with a password. You can see in the below animation that I’ve created a folder named "Demo," which consists of an image and an HTML file.

    Step 1

  2. Now, create a new text file inside the same folder. You can name the text file according to your choice. I’m naming it "LockedFolder.txt."

    Step 2

  3. Click here, and you’ll be redirected to a GitHub repository. Copy the code given on the repo and paste it into the text file that you’ve created in the last step.

    Step 3

  4. Now, open the text file and move your cursor to line number 21 (if NOT %pass%== YOUR-PASSWORD goto FAIL). Replace YOUR-PASSWORD with the password of your choice. In the below animation, you can see that I’ve used "DemoPass" as my password.

    Step 4

  5. Now, click on the File option in the top left corner. Click on the Save as button and save the file as "LockedFolder.bat."

    Step 5

  6. Now, double click on the "LockedFolder.bat," and a folder named "Private" will be created automatically.

    Step 6

  7. Move all the files you want to hide inside the Private folder that we’ve just created in the last step.

    Step 7

  8. Again double click on the "LockedFolder.bat." A command prompt window will open asking you that "Are you sure you want to lock this folder?" Type Y and hit enter as shown in the below animation.

    Step 8

  9. Once you hit enter, your Private folder will be automatically hidden, and only LockedFolder.bat will be visible to you.

  10. To open your secured folder, double click on the LockedFolder.bat file. A command prompt window will open asking you the password of the secured folder.

  11. Type the password and hit enter. Once you do that, your hidden folder will be displayed to you successfully.

    Step 9

  12. If you want to hide your Private folder again, all you need to do is double-click on the "LockedFolder.bat" file again.

So that’s how you can easily hide your private files without using any additional software.

Tags

passwordprotectfolderinwindows10