How to restrict access to files/folders using cmd

How to restrict access to files/folders using cmd

Hello friends! You might have many software on the internet which is used to lock the files and folders. Also you might have seen batch programs that also does the same job. Today I am going to tell you a basic cmd command that can be used to restrict access to files and folders. You must have administrative access for doing this.

Follow these simple steps for locking the folder:

1. Open command prompt in windows.
2. Type: cacls "<path>" /e /p everyone:n
cacls is the command that is used to display or modify access control list (ACL) of a file.
Dont forget to write path in double quotes (" ").

for example: cacls ".\New folder" /e /p everyone:n
You can know more about permissions by writing cacls in command prompt and hit enter. You will get details of all the arguments and permissions.
After the command ran successfully,it will give a message that the directory or file has been processed.

3. Now if you try to open such restricted files or folders then you will get "Access denied" message.

4. Wow! You have successfully locked your files and folders.

Follow these steps to unlock Folder/File:

Unlocking the files and folders is similar to the locking. Instead of giving none access (:n), we have to give full access (:f). Rest things are same.

cacls "<path>" /e /p everyone:f

In this way, you will be able to successfully unlock the files and folders.

Next Post »

Thank you! ConversionConversion EmoticonEmoticon