make folders inaccessible using cmd

These days everyone have their own storage drives like pen drives and HDDs. And these may also contain sensitive information or personal files which you don’t want to share with others. So, this simple trick lets you make folders inaccessible using CMD prompt.

Note: Make sure the folder is present in an NTFS drive. Otherwise, this CMD trick won’t work.

Make Folders Inaccessible using CMD

1. Go to the subfolder that contains the folder you want to make inaccessible.

2. Hold the shift key and right click to open a menu and select “Open command window here” to open the CMD prompt.

3. Type the following syntax into the command prompt.

icacls <folder_name> /deny everyone:F

For instance, the command should be like this:

icacls new /deny everyone:F

make folders inaccessible using cmd

/deny is for the permission rights everyone is for specific users for which the permissions are being set and F is for Full Access which includes Read, Write, Delete etc. As a result, the ‘new’ folder will become inaccessible as well as undeletable. If anyone tries to open or delete the folder, the following messages will be shown.


If you want to open that folder then all you have to do is replace the deny attribute with grant. Type the following syntax in the command prompt and hit the Enter.

icacls <folder_name> /grant everyone:F


This does exactly opposite of the /deny attribute and allows everyone with Full Access permission rights.

So this is how you make folders inaccessible using CMD Prompt. If you find this article helpful then please let us know in the comments below and share it with others as well.