Windows/Take Ownership

From Omnia
Jump to navigation Jump to search

Run from a user in Administrators group, and from a command line window elevated to Administrator permission

takeown /f "C:\Path\To\Folder" /r /d y
# or give ownership to Administrators group
takeown /A /f "C:\Path\To\Folder" /r /d y
icacls "C:\Path\To\Folder" /grant Administrators:F /t
# or
icacls "C:\Path\To\Folder" /grant USERNAME:F /t

If you wanted to then delete the folder:

rmdir /s /q "C:\Path\To\Folder"