Add Take Ownership Option to Right-Click Menu

by Eric Geier [Published on 8 Feb. 2012 / Last Updated on 8 Feb. 2012]

Quickly change ownership of a file or folder to the current logged on user.

The takeown command can be used in the Command Prompt to take ownership of a file or folder even when access is denied. However, if you need this periodically you can add a shortcut to the right-click context menu with a registry edit. Then you’d just have to right-click a file or folder while holding down the Shift key and then select “Take Ownership”.

Open Notepad, insert the following text, and save as Ownership.reg:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\runas]
@="Take Ownership"
"Extended"=""
"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"
"Extended"=""
"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"

Then to apply, execute the Ownership.reg file.

See Also

Featured Links