How to Password Protect a Folder in Windows 10 (Three Ways)

    Want to hide folders from your family? Make them password protected. The following blog post will guide you how to Password Protect a folder in Windows 10.

    how to password protect a folder in windows 10

    Sometimes your computer has lots of sensitive information it can bank information, financial documents, family photos, or some personal picture of you with your girlfriend ????

    No doubt your data is secured, but it is always good to keep yourself on the safe side. Password protecting your folders having sensitive information add a necessary layer of security. Password protect a folder works like a virtual vault, which hides whatever is inside the folder.

    How to Password Protect a Folder in Windows 10

    Wondering how to create a password protected folder? It’s super easy to do. In upcoming lines, I’m going to teach possible ways to put a password on a folder.

    1. Quick workaround (Batch Script)

    Windows 10 with default settings, doesn’t allow users to set a password on a file, but with a quick workaround you can to do.

    All you need to do is write a batch script using a notepad. Here’s what you need to do:

    1. To get started you need to head over to the folder on which you want to put a password. For this tutorial, I’m creating a new folder named as ‘Test.’

    2. Open the folder by making a double click. Inside the folder, you need to create a new text file in which you need to type the code.

    create text file

    To create a text file, make right click on the empty space inside the folder and select New -> Text Document.

    How to Password Protect a Folder in Windows 10

    Inside text document, you need to copy-paste the following code:

    title Folder Locker
    if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
    if NOT EXIST Locker goto MDLOCKER
    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
    ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
    attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
    echo Folder locked
    goto End
    echo Enter password to Unlock folder
    set/p "pass=>"
    if NOT %pass%==your_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
    echo Invalid password
    goto end
    md Locker
    echo Locker created successfully
    goto End

    To set a password, you need to replace your password with “Your Password” in the next line:

     if NOT “%pass%==your_password” goto FAIL

    enter password

    After adding a password into the code, you need to save the file. For that, click on the File -> Save As. You will be asked to give a name to this file. Name it whatever you want, Locker sounds fine to me.

    save file

    Next, save the file with .bat extension. Since I’m naming it Locker so it will look like “Locker.bat.”

    Now, you need to double click on the BAT file which you created inside your folder using the above steps. This will create a new folder with the same name. This is going to be your password protected folder.

    How to Password Protect a Folder

    Copy-paste all your essential documents inside this folder. Once done, again double click on the Locker.bat file. A quick command prompt window will launch asking for your permission.

    Password Protect a Folder in Windows 10

    Type Y and hit enter. And your folder will instantly disappear.

    Now you might be wondering how to get the password protected folder back, right? Double click on the .bat file again. You will be asked to enter the password, and if you type the correct password, it will appear.

    Password Protect a Folder

    Note: This is a useful trick, but .bat can be changed from the computer. It means anyone aware of this workaround can easily unlock folder.

    2. Zip Folder Lock

    In the above workaround, we used a default text editor that comes preinstalled in every person of Windows OS. In this method, we will make use of popular file archiving tool named as 7-zip

    Usually, we use 7-zip to extract the file and unzip the folder. The good thing about this program is that also provides an option to password protect folders. Here’s what you need to do to password protect a folder:

    1. Download and install 7-zip using this link.

    2. Launch 7-zip File manager on your computer.

    3. Next, navigate to the folder for which you want to add a password and then click on the Add option available on the upper right corner.


    This will open “Add to archive” window. Here, you need to head over to ‘Encryption section‘ and enter the secure password of your choice.

    Once you’re done, click on the OK button. In the same folder location, you will get a zip file of the same name (original folder).

    Password Protect a Folder in Windows 10

    As you have created a password protected zip file, you can move the original folder to trash (delete it).

    Note: It is suggested that always put all the important and sensitive data into a separate folder and then zip the file. If you don’t do that, then at the time of extractions all the file will be scattered.

    To extract the zip file, it is not mandatory that you need to a 7-zip program. You can use any archiving tool that supports zip file to extract your password protected folder.

    put password on a folder

    At the time of unzipping, you will be asked to enter the password. Enter the correct password, and you will be able to access the files inside the folder.

    3. Use Hide files and folder feature

    With the method discussed above, you learn how to create a password protected folder. With this method, you can add a layer of security by hiding the folder.

    Here’s what you need to do:

    1. Right click on the folder which you want to hide and select Properties.

    2. Next, head over to Attributes section and tick the box for Hidden.

    How to Password Protect a Folder in Windows 10

    When the “Confirm Attribute” dialog box opens up, make sure “Apply changes to this folder, subfolder, and files.

    Click on the Apply button and then OK.

    Your folder will disappear in no seconds. Now you might be wondering, how to view it back, right? No worries, do this:

    3. In Windows File Explorer, you need to head over to View tab; you will find the option in the ribbon. Here, you need to tick box for “Hidden times“. This will instantly bring back the original folder.

    unhide folders in windows 10

    In case, you want to unhide the folder, then again launch the Folder Properties and uncheck the same option hidden option.

    Check out: How to View Hidden Files in Windows 10

    That’s it!

    These are some of the easy workarounds which you can use to create a password protected folder. It is upto you which method you want to employ.

    Find this my blog post how to put a password on a folder in Windows 10 useful? Is there any other method you’re using to put a password on a folder? Feel free to share your thoughts in the comments.

    Viney Dhiman
    Himachali, Mechanical Engineer, Snooker Lover, Avid drinker of Scotch, Traveler, and Webmaster. (

    Recent Articles

    Related Stories


    1. I found this Bat file to password a folder long time ago and I understood 99%, the 1% I could not get working is the usage of

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

      I have found out this Control Panel was used in Windows version prior to Windows 10 I have now. I searched the C: drive in it’s entirely and did not find anything existing. Also with today’s PC manufactured the D: drive is solely for OS and the D: drive is for all the user folders I want to Password protect. This requires for the Control Panel to be totally qualified if it exist on the C: drive. What can you tell me about the reason for the usage of this Control Panel file. Once I resolve this issue I believe this batch file will work as advertised. So far I have spent a ton of hours with this because there is not much else I could find to do this. Your attention to this matter will be greatly appreciated 2020 04 08 at 1750 hrs Charles

      • It works, I just tested it.

        The piece of code you are referring to is a windows registry edit, to tell windows how to display the folder.

    Leave A Reply

    Please enter your comment!
    Please enter your name here

    This site uses Akismet to reduce spam. Learn how your comment data is processed.