Skip to content Skip to sidebar Skip to footer

How to Lock Folders Using Notepad on PC / Laptop

Did you know that folders on the Windows operating system can be keyed, so that the folder cannot be opened by other people.

You may get annoyed when other people browse the folders on your computer. Some of you may want to lock the folder because there are some important data.

Maybe some of you have thought about locking a folder on your PC or Laptop but couldn’t do it. Well, in this tutorial I will tell you the trick on how to lock a folder on a PC or Laptop using a notepad, in this way you can create a simple folder lock application, see the following tutorial.


1. Create the folder you want to lock.

2. Open the default Notepad application on your PC/Laptop.

3. Then type or copy the following code

cls@ECHO OFFtittle Folder Privateif EXIST "HTG Locker" goto UNLOCKif NOT EXIST Private goto MDLOCKER:CONFIRMecho Are you sure you want to lock the folder(set/p "cho=>"if %cho%==Y goto LOCKif %cho%==y goto LOCKif %cho%==n goto ENDif %cho%==N goto ENDecho Invalid choicegoto CONFIRM:LOCKren Private "HTG Locker"attrib +h +s "HTG Locker"echo Folder lockedgoto End:UNLOCKecho NAMA BEBASset/p "pass=>"if NOT %pass%== PASSWORD goto FAILattrib -h -s "HTG Locker"ren "HTG Locker" Privateecho Folder Unlocked succesfullygoto End:FAILecho Invalid passwordgoto end:MDLOCKERmd Privateecho Private created succesfullygo to End:End

4. Then Save As by the name “locker.bat” without quotes and replace Save As type it becomes All Filesthen click Save.

5. A file with the extension “bat“Named locker then click 2x will appear a folder named “Private“.

6. Move the files you want to lock into the folder “Private” the.

7. Then double click the file “locker”, then the CMD menu will appear:

Type Y if you want to lock, then press ENTER.

Type N if you don’t want to lock, then press ENTER.

8. If you lock it, the folder automatically “Private“It will disappear.

9. If you want to open the folder again, just double click the file “locker“, then you just type password. Your folder will automatically reappear.

Finished. That’s how to make a folder lockable via Notepad.

Also read: How to Hide a Folder with CMD