getButterfly Logo getButterfly code wrangling since 2005

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:

[vb]Windows Registry Editor Version 5.00

@=”Take ownership”

@=”cmd.exe /c takeown /f \”%1\” && icacls \”%1\” /grant administrators:F”
“IsolatedCommand”=”cmd.exe /c takeown /f \”%1\” && icacls \”%1\” /grant administrators:F”

@=”Take ownership”

@=”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”[/vb]

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:

[vb]Windows Registry Editor Version 5.00



Subscribe to getButterfly Blog

Once a week or so we send an email with our best content. We never bug you, we just send you our latest piece of content.

If you found any value in this post, agree, disagree, or have anything to add - please do. I use comments as my #1 signal for what to write about. Read our comment policy before commenting! Comments such as "Thank you!", "Awesome!", "You're the man!" are either marked as spam or stripped from URL.

Leave a reply

Love programming?

Learn about the most amazing things. Get smarter everyday!