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

Contributor Icon Contributed by Rob Rogers  
Tag Icon Tagged: Microsoft 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.

 

3 Comments -


  1. Javier Hernandez Regalado said on January 5, 2010

    Gentlemen;
    Im using 2008 server R2 as desktop; is the above script valid? The takeown command seems not be found on 2008 platform..

  2. leQ said on February 20, 2010

    ya know what? i think this did something to explorer. because, ever since i ran this, explorer has been hesitating for like 20 seconds (or so, i counted). it’s a lag that didn’t used to be there. so, if you would, kindly, let me know what could possibly be behind this, if you say it’s impossible, i’ll start lookin deeper.

    thnx.

  3. Brett said on June 22, 2010

    I have run into a problem with taking ownership of the files..they disapeared from the folders. For example when i go to the music or pictures folder it is shown as empty, but when I click on it to delete the folder, it tells me that it has pictures or music within the folder.

 

RSS feed for comments on this post. TrackBack URL

Leave a comment -