Lock your folder using CMD


Now you can lock Folders by just using simple Command Prompt Commands. This trick uses the built-in functions of Windows. This command strips the user permission from everyone, which makes it an Access Denied folder.
  • Create a folder you want to lock anywhere in any drive (but the drives should be in NTFS format). 
NOTE - The name of the folder should not have any spaces in between (in our example we used the name Folder_Lock).
(If you want to lock a folder that is in your USB Flash Drive, right-click on your USB flash drive and click Format... and select the File system as NTFS and click Start.)

  • Open Command Prompt by pressing Windows Key and type cmd and press Enter
  • Redirect to the location of your folder, 
    • How to redirect:
      • Firstly, if you want to change the drive, type the drive letter followed by ':'. For example in our case, we will lock the folder in J Drive so j:.
      • Secondly, copy the location of your folder from Explorer. Go to the location and click on the address bar and press Ctrl + C
      • Now go to the command prompt type cd<space> and press Ctrl + V to paste the location.
  • Now type the following code:
    • Syntax: cacls <folder_name> /p everyone:n
    • Example: cacls Folder_Lock /p everyone:n (The name should be the same with upper and lower case letters)
  • Press Enter and the command prompt will ask for confirmation, press Y.
  • Done! Now when someone will try to open the folder will get an error.

How to unlock

  • Open the command prompt and redirect to the location of your folder.
  • Type the following code:
    • Syntax: cacls <folder_name> /p everyone:f
    • Example: cacls Folder_Lock /p everyone:f (The name should be the same with upper and lower case letters)
  • Press Enter and the command prompt will ask for confirmation, press Y.
  • Done! Your folder is unlocked.

Video Tutorial


We hope this helps. If any suggestions or doubts you can add a comment and we will reply as soon as possible.

No comments:

Post a Comment