Windows 7: How to Easily Take Ownership of a System File or Folder

Posted January 4, 2010 by Rob Rogers in Windows 7

Normally, taking ownership of a system file or folder can be a bit of a pain, taking numerous steps that can be a major inconvenience. If you do a great deal of tweaking to your system, you are bound to run into an instance where you need to take ownership of a system file to accomplish the tweak. By adding a Take Ownership command to the Explorer context (right-click) menu you will make taking ownership of a file a piece of cake.

1. Open Notepad.

2. Copy and paste the following into the new text document:

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"

3. Save the document as TakeOwnership.reg.

4. Merge the new file into the registry by right-clicking it, selecting Merge.

5. Continue through the UAC prompt and confirm that you wish to perform the action.

 

About Rob Rogers

Once a prolific author here on Tech-Recipes, Rob has moved on to greener pastures.
View more articles by Rob Rogers

The Conversation

Follow the reactions below and share your own thoughts.