The Computer Oracle

recursively change owner windows 7

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Thinking It Over

--

Chapters
00:00 Recursively Change Owner Windows 7
00:22 Answer 1 Score 5
00:40 Accepted Answer Score 114
00:58 Answer 3 Score 27
01:16 Answer 4 Score 125
01:41 Thank you

--

Full question
https://superuser.com/questions/116625/r...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows7 #windows10 #permissions #ownership

#avk47



ANSWER 1

Score 125


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.




ACCEPTED ANSWER

Score 114


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.




ANSWER 3

Score 27


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



ANSWER 4

Score 5


You can use cacls from the command prompt:

cacls "C:\path\to\folder" /E /T /C /G "Administrator":F

The /T switch allows it to function recursively. Replace Administrator with the user you wish to give permissions to.