I just installed Windows 7 on my notebook, and I ran into some issues. I had some old Windows installation on another partition which I wanted to delete. Unfortunately, Windows said I need administrator rights to delete. But I am the administrator. Apparently I am not the owner.
After searching the Internet for a while and finding several solutions that involved a lot of clicking and changing options, I found the most elegant solution of them all.
Open a new text document and write this:
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"
Save it as take-ownership-install.reg and double click on it.
A new context menu option will be now available for files and folders. Use “Take ownership” to make files and folders yours so you can delete them.
In order to remove this behaviour for your Windows 7 installation use the following code and save it as take-ownership-uninstall.reg:
Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT\*\shell\runas] [-HKEY_CLASSES_ROOT\Directory\shell\runas]
Download Take Ownership Registry Pack for Windows 7 here.