Pendrive folder lock using cmd in windows

What is Pendrive Lock?

It is the encryption of Pendrives using any external storage devices using any one encryption method. There are several applications available for locking the storage devices like Pendrives, Memory cards, etc.

This helps you to lock folders inside the Pendrive or Memory card(SD Card) without installing the third party softwares.

Steps to follow: (By images)

Step 1

Insert the Pendrive into the PC or Laptop.

Carefully Note your Pendrive letter which is like H:

Step 2

Then, create a new folder inside the Pendrive and name it. (I have named it as techusers )

Now, run the Command prompt as an administrator.

Step 3

Then type the following commands,

H:
attrib << your folder’s name >> +s +h

Example: attrib techusers +s +h

screenshot

After completing the above cmd, you will notice that the folder hidden.

Step 4

Create the new text document in the same pendrive folder. Then copy the code below and paste into the text document file.

code:

@echo off
set pass=12345      // here set your own password instead of 12345
echo please enter your password
set /p ui=
if %ui%==%pass% (goto open)
echo wrong password
pause & exit
:open
start techusers    // Type your folder name instead of techusers
  • In the 2nd line, you can change the pass= any password.
  • At last line, start <<folder name>>
  • After saving the file as .cmd or .bat file, you can see a cmd file inside your Pendrive folder.
  • Then open the bat file, it will ask for password and enter it…

Then save the file as view hidden.cmd or view hidden.bat or you can save with any name but the extension should be .cmd or .bat

Video Tutorial

Also read: How to hide a folder in windows