Hide And Protect Your Data On Windows Using Batch Files

Hiding of data and files in Windows is easy. Almost every Windows user know how to hide and protect their data. Following steps:

  1. Select the files or folders that you want to hide it
  2. Right-click and choose Properties
  3. Select the General tab
  4. In the Attributes section make the Checkbox checked next to Hidden
  5. Click Apply and OK Button.

So that’s an old techniques to hide files and folder in Windows anyone can make it visible without your permission because Windows has an inbuilt method to make hidden data appear by making checkbox checked next to Hidden items in view tabs of Windows Explorer for Windows 8+ or by selecting show hidden files, folder and drivers under view tab of Folder and search options for windows xp+.

Most of us have private and confidential data but don’t have any private computer to keep that data. Usually, Windows doesn’t have an inbuilt method to password protect your data. But today I will be showing you how to make a password protected file or folder in Windows that is created and accessed using a Batch files (.bat). I can guarantee that this method is very simple, but unfortunately, it is not fool proof. Follow the below Steps to make password protected files and folder.

Hide Your Data On Windows Using Batch Files with Password Protection.

1. Open Notepad (Press  Win+R opens the Run dialogue box and type Notepad then press OK )


2. Copy and Paste the code given below into notepad:-

title Folder Locker
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
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.
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%==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

3. Save the file as Filename.bat ( EG: Locker.bat.)

Save File Name as Locker.bat


4. Double click on Locker.bat (batch) file.


5. After double click on batch file Locker Folder will be visible, Copy all your private and confidential data into that locker folder.

6. To hide Locker folder that contains your private data double click on the locker.bat file again, the popup of command window will appear asking question Are you sure u want to lock the folder type Y to hide the folder else type N.

lock folder

7. To unhide Locker folder click on locker.bat file and enter the default password as “password”

unlock folder


The passwords are set by default to “password”. That can also be changed. To change the passwords go to line no:23  in the code where it says:

if NOT %pass%==password goto FAIL => if NOT %pass%==new password goto FAIL

Leave a Reply

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