1

I can use takeown.exe to give the currently logged in user ownership of a folder. But when I try:

takeown /s jimswork8 /u Everyone /f c:\test /R /D Y

It just gives ownership to the currently logged in user. I CAN do it if I use the UI, so I would think it is possible, but I just can't get the syntax right.

Thanks

5

takeown is a leftover from the days when Microsoft insisted you couldn't set the ownership of a file to someone other than the person logged on. I don't know why the tool lets you specify a username, but it will not honor it as far as I know.

icacls will allow you to set the owner from the command line. But it will not update ACEs. If the file/folder is simply inheriting permissions, following the /setowner command with a /reset command will fix the ACEs.

  • Somehow it fails to set new owner even though I can do it through Explorer. – Euri Pinhollow Feb 27 at 12:31
  • For its own sadistic pleasure, Microsoft showed a preference for takeown in the help screen of the /setowner option in icacls. – eel ghEEz Mar 12 at 16:11
  • My icacls DIR /setowner DOMAIN\DOMUSER /t /c /q showed Access denied, but pushing the ownership to the local admin group takeown /f DIR /a /r /d y, then giving a full permission to that group BUILTIN\Administrators (I belong in it and I logged in as a local user in that group) with icacls DIR /reset /t /c /q, icacls DIR /grant BUILTIN\Administrators:F /t /c /q opened the door to changing the ownership, icacls DIR /setowner DOMAIN\DOMUSER /t /c /q. Caveat: takeown does not grok the \\?\DIR notation making it impossible to process long paths. – eel ghEEz Mar 12 at 18:58
2

This set owner of folder or file to group Everyone - works on windows 7 and above:

icacls "full path of file with file extension" /setowner "Everyone" /T /C

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.