recursively change owner windows 7
To fix really broken permissions, the best is to run these two commands one after the other:
takeown /f "C:\path\to\folder" /r
icacls "C:\path\to\folder" /reset /T
The first one will give you ownership of all the files, however that might not be enough, for example if all the files have the read/write/exec permissions set to "deny". You own the files but still cannot do anything with them.
In that case, run the second command, which will fix the broken permissions.
Use takeown
from the command prompt to take ownership a folder, all its subfolders and files recursively:
takeown /f "c:\folder\subfolder" /r
This works well, but if you don't run your command line console as administrator it may fail for files you don't own.
Note that cacls is deprecated (since Windows Vista?) and it advises you to use icacls
.
This command will recursively reset the permissions on a folder:
icacls "C:\path\to\folder" /reset /T