Windows 7 / Getting Started

Taking Ownership of Your Files

When you're working in Windows 7, you may have trouble with a folder (or a file) because Windows tells you that you don't have permission to edit (add to, delete, whatever) the folder. You might think the solution is to give your user account Full Control permissions on the folder, but it's not as easy as that. Why not? Because you're not the owner of the folder. (If you were, you'd have the permissions you need automatically.) So the solution is to first take ownership of the folder, and then assign your user account Full Control permissions over the folder.

Here are the steps to follow:

  1. Use Windows Explorer to locate the folder you want to take ownership of.
  2. Right-click the folder and then click Properties to open the folder's property sheet.
  3. Display the Security tab.
  4. Click Advanced to open the Advanced Security Settings dialog box.
  5. Display the Owner tab.
  6. Click Edit.
  7. In the Change Owner To list, click your user account.
  8. Activate the Replace Owner on Subcontainers and Objects check box.
  9. Click OK. Windows 7 warns you that you need to reopen the property sheet to change the folder's permissions.
  10. Click OK in the open dialog boxes.
  11. Right-click the folder and then click Properties to open the folder's property sheet.
  12. Display the Security tab.
  13. If you do not see your user account in the Group or User Names list, click Edit, click Add, type your username, and click OK.
  14. Click your username.
  15. Click the Full Control check box in the Allow column.
  16. Click OK in the open dialog boxes.

Note that, obviously, this is quite a bit of work. If you only have to do it every once in a while, it's not big thing, but if you find you have to take ownership regularly, you'll probably want an easier way to go about it. You've got it! Listing below shows a Registry Editor file that modifies the Registry in such a way that you end up with a Take Ownership command in the shortcut menu that appears if you right-click any folder and any file.

A Registry Editor File That Creates a Take Ownership Command
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\runas]
@="Take Ownership"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\*\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"

[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Take Ownership"
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"

To use the file, double-click it and then enter your UAC credentials when prompted. Rright-clicking (in this case) a folder displays a shortcut menu with a new Take Ownership command. Click that command, enter your UAC credentials, and sit back as Windows does all the hard work for you!

[Previous] [Contents] [Next]