Windows change access permissions from the command line

by on April 11, 2006 · 22 comments· LAST UPDATED April 11, 2006


Linux and Unixish system comes with chmod and other commands to setup/change access permission from command line/shell.

However, when it comes to windows chmod is not available. Windows comes with a special command line utility called CACLS.

You can use it as follows:


  • /p : Set new permission
  • /e : Edit permission and kept old permission as it is i.e. edit ACL instead of replacing it.
  • {USERNAME} : Name of user
  • {PERMISSION} : Permission can be:
    • R - Read
    • W - Write
    • C - Change (write)
    • F - Full control

For example grant Rocky Full (F) control with following command (type at Windows command prompt):

C:> CACLS files /e /p rocky:f

Read complete help by typing following command:

C:> cacls /?

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 22 comments… read them below or add one }

1 Top Coder - Ankit Baphna November 13, 2008 at 8:08 am

You can use *.* in place of files to change access mode of multiple files at a time.


2 Alex May 16, 2009 at 7:28 am

Super dude.. i got in a right time.. thanks for your contribution and sharing of knowledge..keep doing..


3 J. February 5, 2010 at 3:02 pm

/T is a very nice switch in case of an entire drive’s permissions getting messed up. Recursion ftw?


4 Guarantor Loans August 8, 2010 at 10:37 am

Life saver! Just used this after having problems with explorer! worked a treat! Thanks!


5 nevelis November 15, 2010 at 7:30 am

This helped me get rid of a virus – there was a process that kept spawning an executable inside of AppData\Temp, so I ran:

cacls hki304.exe /D

/D for “deny access”, which stopped the process from being able to be started, and then the process that was spawning this revved up to 50% CPU. Gotcha ya bastard :)

Thanks for the tip!


6 elango November 26, 2010 at 11:56 am

thanks correct time tell the answer for me



7 Cody December 7, 2010 at 8:53 pm

Awesome, this was a life saver. I was working on a client’s PC and the host file got locked out somehow. It wasn’t visible, even while showing hidden files. I could open it through the command line but wouldn’t let me save it or edit it. Tried numerous things, scans, safemode, changing the attributes via command line, the whole nine yards. Only thing that worked was using this command.
“CACLS hosts /p administrator:f”
Then after that I was able to change the attributes and then edit the file back to normal. Thanks a ton OP


8 manu April 21, 2011 at 12:23 am

I tried it but, couldn’t get it done. Dont know why my command prompt accept the command I am using :(


9 Me May 20, 2011 at 1:41 pm

Did you right click and run your command prompt as an administrator?


10 Ibs June 2, 2011 at 10:38 pm

i went through your instructions as listed and the command line said this “No mapping between account names and security IDs was done” dont know what this means??


11 TameDrone June 9, 2011 at 12:08 am

I need help because while trying to shutdown another computer in my home it is saying failed to find registry and i can’t figure how to add special permissions to my thing.


12 sahamat khan June 23, 2011 at 7:59 pm

here what is the meaninig by files???


13 It is the folder name or path to that folder August 3, 2012 at 2:50 pm

C:\Users\sudheesh\Videos>cacls filims /e /p sudheesh

syntax : > cacls — > is the keyword that does the job for you.
filims —> is the name of the folder needed to be deleted in my case .
/e —> stands for editing the permissions.
/p —> stands for creating a new permission .
sudheesh –> my username

processed dir: C:\Users\sudheesh\Videos\Filims


14 KillerJH2 June 27, 2011 at 3:59 pm

my permissions list got scrambled so i had to delete all permissions (stupid i know)
and now this is working but access denied
and i want to punch my laptop so hard :L


15 MattH October 12, 2012 at 5:26 pm

I was doing some work in my Digital forensics class and accidently set my admin permission to read only. when I use this method to try and set permission it doesnt seem to change anything. How do I get my admin right back to my admin without using admin obviously to set it. System still has full access obviously so I thought that command prompt would solve this issue.


16 Job October 24, 2012 at 10:27 pm

Trying to recover data from a dead computer. Used Apricorn adapter to view IDE drive via usb connection. Am able to view and extract data from Administrative and All Users but not from user phbergh. I used the command CACLS PHBERGH /P PAUL:F and was able to cd to phbergh. I got access denied when trying to access My Documents for phbergh. I then used the command line CACLS *.* /T /P PAUL:F and after answering I was sure I received the access denied message. What am I doing wrong? Please help me.


17 Tliimfee December 22, 2012 at 4:05 am

Access is denied despite being signed in as admin? Any suggestions?


18 Cynara December 26, 2012 at 5:26 am

this works only for files in NTFS permission. How about for exFAT?


19 v March 23, 2013 at 4:07 pm

it does not worked for me. Access was denied while changing permission of a directory.


20 rakesh kumar jena May 9, 2013 at 1:20 pm

i have locked a folder in my computer by using cacls (folder name) /e /p everyone:n
but when i want to unlock this i have used CACLS files /e /p everyone:f
but i am unable to open this file
please help how i can unlock this folder


21 Mark September 28, 2013 at 7:32 pm

Thank you so much!


22 mark March 29, 2014 at 7:08 pm

Bought a computer and it won’t let me add or remove programs or anything says I don’t have permission please help


Leave a Comment

Previous post:

Next post: