There are two small tools in Windows which saved my day multiple times. I didn’t bother to write a blog post since I thought that it was not worth it but the two tools got me out of a big problem today (again). To appreciate the two tools I decided to write it down briefly.
With any further ado let me introduce them as below. The nice thing is that they are in the box.
Takeown.exe – take ownership of files/directories
Cacls.exe – change ACLs of files/directories
My case today
My system hanged when I did a certain operation which unfortunately I need to do regularly. This was very annoying since I couldn’t work effectively. To fix it I need to copy a system file to a system folder. This is not an easy operation. You will get access denied by default. If you don’t believe it open the folder c:\windows\winsxs (replace c: with your system drive) try to create a new file/folder or delete anything or copy anything there.
What I did is very simple. I just ran the below command to take control of that folder and copied the file there. Then I could solve the problem.
takeown /f [foldername]
cacls [foldername] /G [username]:F
If you run into any problem related to access denied when doing any file/directory access operation feel free to give these two cute tools a try. It won’t disappoint you.