How to Add “Take Ownership” to the Context Menu in Windows Explorer

Taking ownership of files or folders in Windows is not simple. Both the GUI and command line take too many steps. I’ll will show you how to add a simple context menu command that lets you take ownership of any file or folder.

In Windows, a user that has ownership of a file or folder has implicit rights to change permissions on that object. That user is also always allowed to access the file or folder – even when other permissions seemingly contradict that access.

Sometimes, you might run into a situation where you need to take over the ownership of a file or folder. It might be a system file you need to alter to apply some hack – like replacing Notepad with another text editor – in which case, a built-in user account named Trusted Installer has the ownership by default. Or you might have a hard drive from another computer that you need to control files on.

Whatever the reason, you can take ownership by using the various permissions dialog boxes in Windows or by using the Command Prompt. But both methods require that you complete several steps. With a few edits to the Registry, though, you can add a simple “Take Ownership” command to the File Explorer context menu that lets you take ownership in one step. We’re going to show you the manual method for making those changes to the Registry, but we also have a one-step hack you can use to install those changes without the hassle.

To add a “Take Ownership” command to the context menu in any version of Windows, you just need to make some changes in the Windows Registry. It’s a fair list of changes, and you’ll be working in two separate Registry locations.

Open the Registry Editor by click Start and typing “regedit.” Press Enter to open Registry Editor and give it permission to make changes to your PC.

You’re going to make the same set of changes in two locations in the Registry. The first location adds the “Take Ownership” to the context menu for files of any type and the second location adds the command to the context menu for folders.

Add the “Take Ownership” Command to the Context Menu for Files

In the Registry Editor, use the left sidebar to navigate to the following key:

HKEY_CLASSES_ROOT\*\shell

Next, you create a new key inside the shell key. Right-click the shell key and choose New > Key. Name the new key “runas.” If you already see a runas key inside the shell key, you can skip this step.

Next, you going to change the (Default) value inside the runas key. With the runas key selected, double-click the (Default) value to open its properties window.

In the properties window, type “Take Ownership” into the “Value data” box and then click “OK.” The value you type here will become the command you see on your context menu, so feel free to change this to whatever you want.

Next, you going to create a new value inside the runas key. Right-click the runas key and choose New > String Value. Name the new value “NoWorkingDirectory.”

Now, you’re going to create a new key inside the runas key. Right-click the runas key and choose New > Key. Name the new key “command.”

With the new command key selected, double-click the (Default) value in the right pane to open it’s properties window.

In the “Value data” box, type (or copy and paste) the following text and then click “OK.”

cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F

Now, you need to create a new value inside the command key. Right-click the command key and choose New > String Value. Name the new value “IsolatedCommand” and then double-click it to open its properties window.

In the “Value data” box, type (or copy and paste) the following text and then click “OK.” Note that this is the same command we just added to the (Default) value.

cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F

And that adds the “Take Ownership” command to the context menu for files. Let’s move on to the changes you need to make to get the command onto the menu for folders.

Add the “Take Ownership” Command to the Context Menu for Folders

To add the “Take Ownership” command folders, you’re going to make essentially the same changes you just made in the previous section, but to a different location in the Registry. In Registry Editor, use the left sidebar to navigate to the following key:

HKEY_CLASSES_ROOT\Directory\shell

Next, you create a new key inside the shell key. Right-click the shell key and choose New > Key. Name the new key “runas.” If you already see a runas key inside the shell key, you can skip this step.

Next, you going to change the (Default) value inside the runas key. With the runas key selected, double-click the (Default) value to open its properties window.

In the properties window, type “Take Ownership” into the “Value data” box and then click “OK.” The value you type here will become the command you see on your context menu, so feel free to change this to whatever you want.

Next, you going to create a new value inside the runas key. Right-click the runas key and choose New > String Value. Name the new value “NoWorkingDirectory.”

Now, you going to create a new key inside the runas key. Right-click the runas key and choose New > Key. Name the new key “command.”

With the new command key selected, double-click the (Default)value in the right pane to open it’s properties window.

In the “Value data” box, type (or copy and paste) the following text and then click “OK.”

cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t

Now, you need to create a new value inside the command key. Right-click the command key and choose New > String Value. Name the new value “IsolatedCommand” and then double-click it to open its properties window.

In the “Value data” box, type (or copy and paste) the following text and then click “OK.” Note that this is the same command we just added to the (Default) value.

cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t

And you’re finally done. You can close Registry Editor. These changes should take place immediately, so test it out by right-clicking any file or folder and making sure you see the “Take Ownership” command.

If you want to reverse the changes at any time, just head back into the Registry and delete the runas keys you created in both locations. This will also delete everything you created inside. If you already had runas keys in those locations – for example, you applied other hacks – just delete the command keys you made instead.

DownloadTake Ownership Menu Registry Hacks

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s