Home Windows How to lock a Folder using Command Prompt

How to lock a Folder using Command Prompt


How to lock a Folder using Command Prompt :-

Command prompt is one of the most powerful application in windows OS. If you have knowledge about Command prompt means you have knowledge about Windows OS in proper way. If you are familiar with command, you can easily done your work on any windows OS with less effort.

Today I am going to show you how easily you can lock a folder using command prompt in few commands and if you did same thing GUI, it will takes more effort.

First open the command prompt (start menu > cmd ) with Run as administrator.


Now I want to create a folder in D drive, so on the command prompt Change your Directory to D drive and create a folder with mkdir command.


I create a Folder named rumytest in the D drive. If you want to view your folder then enter the command dir on the same prompt.

Now on the same command prompt, enter the command

D:\>cacls D:\yourfoldername /e /p everyone:n


Now when you open a Folder, you will get the access denied error. To open this folder you need a administrator permission and click on the continue.


Now if you want to know what that small command did, Right-click on the Folder > Properties > Security tab. here you will see the Deny permission to everyone.


Now if you want to remove the restrictions then enter the command

D:\>cacls D:\yourfoldername /e /p everyone:f

Here you only changed the last value. you replace the no value to false value.

If you are thinking How this trick is effective to you ? Suppose you have 2-3 users in your PC and you want to put the restrictions on your folder so other users are not able to seen your folder contents. in this condition it,s effective for you.

You can easily find out the User on your System with net user command on the command prompt. As you seen in below image my pc have four users named Administrator , Guest, Rumyittips and test.


Now suppose you want to put the restrictions for Rumyittips user then replace the everyone to Rumyittips.

D:\>cacls D:\yourfoldername /e /p Rumyittips:n


Enjoy your Folder restrictions without any software.

Hope you like my post.How to lock a Folder using Command Prompt. Please Share with others.