Home Internet Tips and Tricks How To Hide And Lock Your Files Or Folders Using Batch File...

How To Hide And Lock Your Files Or Folders Using Batch File Programming In Windows


With the tremendous amount of data flowing through your system every day, you might need to make very sure to safeguard your data from any unauthorized access. You must take care to hide and lock your files or folders.

Files storage may be online or it could be stored on your personal hard drives in the computer. For online information, you may simply safeguard and protect it using firewalls, network security, strong passwords of your online storage portals and so forth.

But when your files are stored on your hard drives on the computer, you might want to make sure to safeguard your valuable information and data from any online malicious software, viruses, and malware and most importantly from any unauthorized physical access. In fact, physical access would be much more vulnerable as compared to the online threat as it will surely give the user complete access to all of your data, right?

So, what should be the proposed solution?

This Article will tell you a very simple way to protect your physical data stored on your computer using batch file programming. The program will help you to hide and lock your files or folder with a password.

Also Read: Top 10 Hottest Female Hackers In The World

Have you got any privates files on your computer or some images that you don’t want anyone else to access?

Let’s jump straight into few simple steps to set up the hide and lock folder basic software on your computer yourself.

  1. Open any text editor like Notepad, Notepad++. The text allows you to simply feed your code to the folder you want to hide.
  2. Now you need to use this code, simply paste the code in your text editor and save it with any file name and extension ‘.bat’. For example, the file name could be ‘private.bat’.

batch script

@echo off

title Folder XYZ

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%== secret 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

  1. After saving the code file as a .bat extension, now you need to simply double click on the file, and what it dies is that It will create a directory in the same location of the file. (The name of the directory you want to create can be altered from the code itself, in our code we have named the directory as ‘Locker’)
  2. Once the directory is created, now transfer your files or folders in the directory.
  3. After transferring the files which you want to hide inside the directory, double-click again on the ‘Private.bat’ file which will pop up a prompt for you with a question ‘Are you sure you want to lock the folder?’

Click (Y/N): Y

Lock folder

And, the directory will no longer be visible ie it’s hidden now.

  1. Now, to restore the directory again for use, simply double-click on the ‘Private.bat’ file and it will open a prompt for you who says ‘Enter your password to continue’, Type in the password you have mentioned during the setup of the directory. In our case, the password is ‘secret’.
  2. Once, you enter the password, it will make the directory visible again for your access.

Unlock the batch file scripted folder

Pretty simple and easy, right?

In case, if you feel stuck at any point during the setup of the process or the code, please do let us know in the comments section below, and we would be more than happy to assist you.

But, there is one thing that everyone should really know that this method of hiding files is not very secure when it comes to real threat. However, for a simpler purpose like hiding your personal files like photos, documents, videos on your personal computer, the tip is a good one.

This batch script only allows you to secure files with a password, and so the only person who knows the password can access those files, but for tech-savvy people and anyone who is good with programming or could understand the script of the batch file program can crack the password. But understanding batch file programming is what will really be needed to crack any batch script based password secured files or folders.

The trick will work fine on just any window machine, however, we will always suggest you to not just stick to one trick, rather learn the fundamentals of batch file programming so as to learn many such more tips and tricks.

Stay tuned to us to learn more such new and amazing stuff.

Vinayak Ganigerhttps://vinstechs.com
Vinstechs founder and an aspiring Entrepreneur. He is a proud Geek and he is very much passionate about Technology, Ethical Hacking, Programming and Artificial Intelligence. He believes that "In Technology Whatever Can Be Done, Will Be Done". You can Email him at [email protected]

Leave a Reply

Must Read

How To Download All Your Tinder Data?

Tinder has become the main reference when looking for a partner on the internet. A whole catalog of people to slide with,...