How to Take Ownership of a File in Windows 10

Taking ownership of files or folders in Windows is not simple. Both the GUI and command line take too many steps. Why not add a simple context menu command that lets you take ownership of any file or folder?

You can add a "Take Ownership" command to your context menu by editing the Registry manually in two locations—one for files and the second for folders. You can also just download our one-step Registry hacks to make those changes for you.

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.

Note: The technique in this article works in most versions of Windows—from Vista on up through 7, 8, and 10.

Add "Take Ownership" by Editing the Registry Manually

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. But take your time, follow the steps, and you'll get there. And if you'd rather not make the changes yourself, you can skip ahead and just download our one-step hacks. We would recommend at least skimming this section, though, so you understand the changes getting made.

Standard warning: Registry Editor is a powerful tool and misusing it can render your system unstable or even inoperable. This is a pretty simple hack and as long as you stick to the instructions, you shouldn't have any problems. That said, if you've never worked with it before, consider reading about how to use the Registry Editor before you get started. And definitely back up the Registry (and your computer!) before making changes.

RELATED: Learning to Use the Registry Editor Like a Pro

Open the Registry Editor by hitting 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'll 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're 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're 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'll 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're 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're 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\" /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've applied other hacks—just delete the command keys you made instead.

Download Our One-Click Registry Hacks

There are a lot of steps if you perform this hack manually, so we don't blame you for wanting to use the quicker method. If you don't feel like diving into the Registry, we've created a couple of hacks you can use. The "Add Take Ownership to Context Menu" hack creates the keys and values you need to add the "Take Ownership" command. The "Remove Take Ownership from Context Menu (Default)" hack deletes those keys, removing the command and restoring the default setting. Both hacks are included in the following ZIP file. Double-click the one you want to use and click through the prompts.

Take Ownership Menu Hacks

RELATED: How to Make Your Own Windows Registry Hacks

These hacks are really just the runas key, stripped down to the new keys and values we talked about in the previous section and then exported to a .REG file. Running the hacks just creates or deletes the keys for adding the command to the context menu. And if you enjoy fiddling with the Registry, it's worth taking the time to learn how to make your own Registry hacks.

How to Take Ownership of a File in Windows 10

Source: https://www.howtogeek.com/howto/windows-vista/add-take-ownership-to-explorer-right-click-menu-in-vista/

0 Response to "How to Take Ownership of a File in Windows 10"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel