Fix Permissions in Windows With takeown and icacls
In Windows, we sometimes run into files or folders we can not access, even with elevated privileges. The takeown tool helps us solve this problem by letting us take ownership of those files or directories. Once we own them, we can adjust permissions or grant access as needed.
The basic command looks like this:
For example, if we run takeown /f C:\LockedFolder, the ownership of that folder changes to our account. If we need to apply this to all files and subfolders, we can use /r for recursion and /d Y to confirm changes automatically. Be aware that the Y is a parameter that Microsoft localised – check the documentation if you need a Y or a J (for Ja in German).
Taking ownership alone does not always give us full access. After using takeown, we usually follow up with the icacls command to grant ourselves the necessary permissions. For instance, icacls <file> /grant Users:F ensures we have complete control.
While takeown is powerful, we should use it carefully. Changing ownership of system files can affect Windows stability or reduce security if misapplied. Still, when used properly, it is an essential tool for recovering access, cleaning up old files, or fixing permission issues.