How to: Add Take Ownership To the Context Menu on Windows 10
A context menu is the result of an action on the Graphic User Interface. The most popular context menu is the one for right-clicking. Once you right-click on a file, folder, or drive, the resulting menu is that item’s context menu. Now, when using the PC you may want to assume full control of certain amenities such as folders or important files. How about having such a command right in the context menus? You can do this in Windows 10. Basically, you can own a file, an entire folder, or even the drive all in one instance. BUT don’t apply for the take ownership on the c:\ drive, because it has system users and permissions – which if messed up, will require a windows re-installation. Only do this on files, and folders, or external drives if you want.
Simply make the current user the owner of the resource in question and grant them elevated permissions. Of course, before changing ownership you have to be logged in as, or be having Administrator privileges. If not, UAC will prompt you to acquire Administrator privileges before proceeding. Standard users may be prompted to key in the Administrator password as well (the only difference is the ownership will be granted to the specified account with administrative privileges and NOT the standard user account). Otherwise, as an Administrator all you need to do is click “yes” and you’re good to go. However take note that application files such as CMD files, EXE files, etc. will not have “take ownership” in their context menus. Instead, they will continue to have the “run as Administrator” option.
Before proceeding with taking ownership there are a few things you have to take into account. The below procedure works for Windows 10 systems whose language is set to English.
How to Add the Take Ownership Option in the Context Menu
Through Registry Files:
Download this file. This is a compressed file, and you will need to decompress or extract it using WinRar or WinZIP. After you’ve extracted the files, there will be two registry files in the folder. Run the one that says to Install, and if you wish to uninstall it, then run the one with the words uninstall in it.
When you run it, agree to the UAC prompt by clicking Yes, and then choose YES again when the registry editor wants you to confirm the addition. Once done, reboot the PC.
After the reboot, “Take Ownership” option will be added in both folder and file context menus. Once you right-click any folder or file, you immediately become the owner of that computer resource. You will be at liberty to carry out any changes you wish to on the specified file, folder, or drive.
More advanced computer users can manually take ownership of a drive, file, or folder. This is done through coding in the command prompt. The procedure varies slightly for files and folders. The steps are:
Run command prompt as administrator. Hold the Windows Key and Press X. Choose command prompt (admin)
Key in the following command
takeown /f filename
icacls filename /grant administrators:F
This will take ownership of a file and assign full permission to it. For a folder, the code is
takeown /f foldername /r /d y
icacls foldername /grant administrators:F /t
Manually through Registry:
We need to make some changes to your computer’s registry. This process can be considered a long and tedious task but, you only have to go through it once and life will be easy. Do note that Registry Editor is a very powerful tool in Windows and you should be very careful when making changes to it. Backup your registry or create a restore point of your Windows if you have important data on the PC.
- Press Windows + R to launch your computer’s Run Type “regedit” in the dialogue and hit Enter. This will launch the Registry Editor.
We are going to make changes in two locations in the registry. The first location will add the “Take Ownership” to the context menu for files of any type while the second location will add the option to the context menu of any folder.
- Now navigate to this location when in the Registry Editor using the left side of the screen.
HKEY_CLASSES_ROOT > * > shell
- Now we need to create a new key inside the shell key. Right-click on the shell key and choose the option “New> Key”. We need to name the key “runas”. If you already have this key in your registry, you can skip this step and move on with the next one.
- Now we are going to change the Default value present inside the key runas we just created. Select the runas key and double click the “default” quickly to open its Properties.
- Once in the properties, type “Take Ownership” into the Value Data box present. Click “OK” to save your changes. This value will become the command when you open the context menu. You can also change it to any other name if you want.
- Now we are going to create a new value inside the runas key. Right click on the runas key and choose “New > String Value”. Name the new value as “NoWorkingDirectory”.
- Now we are going to create a new key inside the runas key. Right click on the runas key and choose “New > Key”. Name the new key as “command”.
- Now with command key selected, double-click on the Default value present on the right pane to open its properties.
- In the Value Data box present in the properties, type the following code (take care of the spaces and the numerical values). Click Ok when you are done.
- Now we need to create a new value inside the command key. Right-click the command key and select “New > String Value”. Name the new value as “IsolatedCommand”.
- After naming it, double click it to open its properties.
- In the Value Data box, type the following text and press Ok. This is the same command we added earlier to the default value.
This will add the “Take ownership” command to the context menu for files.
Now we will add the context menu option to folders. We are going to make essentially the same changes we did earlier but to a different directory.
- Navigate to the following path in your Registry Editor.
HKEY_CLASSES_ROOT > Directory > shell
- Now we need to create a new key inside the shell key. Right-click on the shell key and choose the option “New> Key”. We need to name the key “runas”. If you already have this key in your registry, you can skip this step and move on with the next one.
- Now we are going to change the Default value present inside the key runas we just created. Select the runas key and double click the “default” quickly to open its Properties.
- Once in the properties, type “Take Ownership” into the Value Data box present. Click “OK” to save your changes. This value will become the command when you open the context menu. You can also change it to any other name if you want.
- Now we are going to create a new value inside the runas key. Right click on the runas key and choose “New > String Value”. Name the new value as “NoWorkingDirectory”.
- Now we are going to create a new key inside the runas key. Right-click on the runas key and choose “New > Key”. Name the new key as “command”.
- Now with the command key selected, double-click on the Default value present on the right pane to open its properties.
- In the Value Data box present in the properties, type the following code (take care of the spaces and the numerical values). Click Ok when you are done.
- Now we need to create a new value inside the command key. Right-click the command key and select “New > String Value”. Name the new value as “IsolatedCommand”.
- After naming it, double-click it to open its properties.
- In the Value Data box, type the following text and press Ok. This is the same command we added earlier to the default value.
This will add the “Take ownership” command to the context menu for folders.