Software: Windows 7, 8 & 10 | Last modified on 2018-06-18
Avoid using this process on system directories & files as it might cause security risks.
A guide to using the takeown & icacls commands for taking ownership and resetting permissions of directories and files with the Command Prompt or PowerShell.
Take ownership of a file or folder
- Open the Command Prompt (Admin) or PowerShell (Admin).
- The following commands are available for changing permissions:
- takeown /F directory\* /R /A
icacls directory\*.* /T /grant administrators:F
Example:
takeown /F C:\Users\Test\* /R /A
icacls C:\Users\Test\*.* /T /grant administrators:F
Replace directory with the path of the directory or files you wish to take ownership of.
Replace administrators with the group of users you wish to assign to the directory or file.
The wildcards (*) at the end of the path means that all files within the defined directory will also have their permission changed.
Reset ownership & permissions
- Open the Command Prompt (Admin) or PowerShell (Admin).
- The following command is available for resetting permissions:
- CD driveLetter:\ icacls * /T /Q /C /RESET
Example: CD D:\ icacls * /T /Q /C /RESET
Replace driveLetter with the assigned letter of the disk drive.