How to create a hidden, password protected folder on Windows without any third-party program [Guide]

Do you use software, or a program, or an application to make your file(s) or folder(s) private (password protected) in Windows? How about making a folder private (password protected) in Windows without using a program, or having programming skill at all? This article shows you have to do that.

In this article we are showing you how to create a simple custom script that makes a hidden folder that can only be opened using a password. This should work on Windows XP and higher (meaning Windows XP, Vista, Windows 7, and Windows 8) although I’ve tested it on Windows XP and Windows 7 only.

To password protect a folder on Windows, first open Notepad and copy & paste the entire script given below. Use your custom password in place of the word marked in red, and save the file as file.bat instead of file.txt (if you don’t want to use ‘file’, any name is okay but it must be a .bat file).



title Folder Locker

if EXIST “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” goto UNLOCK



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



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 the folder

set/p “pass=>”

if NOT %pass%== 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


Now, place the file.bat in a directory which, you think, may not be visited by a person other than you (there is a reason for that, please keep reading). Then, double-click on the file.bat, and you will see that a new folder Locker is generated in the same directory. You drag-n-drop all of your private files and folders in this Locker. Now again, double-click on the file.bat. A black window will open up, and ask, “Are you sure you want to lock the folder(Y/N)“. You type y, and hit Enter. You will immediately notice that the folder Locker vanishes! If you want to bring it back, you again double-click on the file.bat. A black window will open up again, and ask, “Enter password to unlock the folder“. You type your custom password, and hit Enter. The folder Locker will be visible again.

Oh well, there is a little issue in this method. If you want to use this script method in Windows 7, both “Don’t show hidden files, folders, or drives” and “Hide protected operating system files (Recommended)” must be enabled. You can do this by going to Organize > Folder and search options, and then to View tab in Windows Explorer. If you want to use this script method in Windows XP, both “Do not show hidden files and folders” and “Hide protected operating system files (Recommended)” must be enabled. You can do this by going to Tools > Folder options…, and then to View tab in Windows Explorer. Do you see the problem? Yes, you got it, anybody may disable those two options to discover your hidden gems! This is why I said that the file.bat should be placed in a directory which, you could think, might not be visited by a person other than you. Admittedly, this method does not offer protection/privacy of your files/folders from a person who has some standard computer knowledge. Nevertheless, it may work but use with caution.


Related Posts