Folder lock without any external software using cmd windows

Do you know there is a way to password protect a folder with just some lines of code using cmd (command prompt) in Windows? It is way easier than you think and this will also hide your folder. At the end of this guide, you will be able to lock a folder with a password using cmd in any version of Microsoft Windows 7/8/10. You can hide anything just by putting your files inside this folder. The folder will open only with a password that you set and nothing else.

You can also consider it as a free alternative of tools like FolderLock, Veracrypt. If you still want to purchase an additional tool you can do it from here.

We have some other easy and crazy things that you never know existed in Windows – Create an invisible folder, How to hang anyone’s PC with one line, Change the name of your processor.

So, here is the step by step tutorial/guide on how to hide your videos, documents in a password protected folder in Windows 10/8/8.1 without additional software.

Step 1: Choose a folder that you want to hide. Put it somewhere safe, so that your kid, parents, or wife never finds out.

Step 2: Now, create a new text file at the same location of your folder.

Right click anywhere choose New > Text File.

Step 3: Open the file in notepad or any text editor. Put the following code inside the text file

@ECHO OFF
title Folder Private
if EXIST "HTG Locker" goto UNLOCK
if NOT EXIST Private goto MDLOCKER
:CONFIRM
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.
goto CONFIRM
:LOCK
ren Private "HTG Locker"
attrib +h +s "HTG Locker"
echo Folder locked goto End
:UNLOCK echo Enter password to unlock folder
set/p "pass="
if NOT %pass%== PASSWORD_GOES_HERE goto FAIL
attrib -h -s "HTG Locker"
ren "HTG Locker" Private
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Private
echo Private created successfully
goto End
:End

Step 4: In the above text you will see “PASSWORD_GOES_HERE”, its where you have to put your password. Write whatever you want, that is easy to remember. For example, if I want to use password as “Techcrook” then that line will look something like below:

if NOT %pass%== Techcrook goto FAIL

Reminder: Passwords are case sensitive so if you used Techcrook then techcrook as a password will not work.

Step 5: Click “File” >> “Save as” and save it with any name you want but append it with .bat make sure you have selected All(*) in save as type before appending. Now the text file icon will change something to like below.

Step 6: Open the file that we just created ie. Double click on the file. Now you will see that a folder named Private gets created. Now, move the folder that you want to secure into this private folder.

Step 7: Now, its time to lock the folder up so no one knows can see the documents inside the folder. Double click on the file again. Now, the command prompt will open and ask you whether you want to do lock the folder or not. Write Y and click enter.

Now, the magic will happen and your secrets are safe, your successfully password protected a folder. Your folder is successfully password-secured without any additional software, just by cmd. You will also notice that your secret folder is now hidden and the folder is empty.

How to access your folder using cmd again with password

To access the folder again you have to open the file again that we created. It will now ask for a password. Just enter your password and the folder is magically back again.

Its way more easy when you actually view how its done in the below video:

https://youtu.be/BS4EoAoEzuw?list=PLCycSTSZy0SRn-UJDZxclqj177pXQzFiJ

1 thought on “How to lock a folder with a password in Windows 7/8/10 using cmd

Comments are closed.

Buy Chobby NTO

Mint a Chobby at $250: Get 1000 $CHO($910), $600,000 in Raffle, 5% royality future sales