Usually, you get full control of your current PC when you log into Windows. However, sometimes you may need access to certain files and folders that belong to other user accounts on your system, or you may want to make certain tweaks to your Windows that require you to change ownership of your Windows files and folders
What Changing Ownership Means?
When you change the ownership of a certain file in Windows, you get the explicit rights to change the permissions on that file. Changes that you make to this file are not stopped because of other permissions that seem to contradict these changes. You can also get control over certain files on a hard drive from another computer.
Take Ownership Of Files And Folders
In this article, I will show how to take ownership of files and folders using the File Explorer and Command Prompt, and I will also show you how to use the registry editor to add the option in context and right-click menu.
→Using File Explorer
If there is a certain file you want to get full access to, you can do so by using this method that utilizes the File Explorer to change the permissions to grant you full access to the file. Follow these steps to do so:
- Open File Explorer.
- Browse to the file or folder that you want to change access to.
- Right-click on the file and select Properties.
- Under the Security tab, click on Advanced.
5. In the Advanced Security Settings dialogue box, click on Change next to the Owner name.
6. In the following Select User or Group window, click on Advanced and select Find Now.
7. In the search results that follow, locate your username and click OK.
8. Back in the Advanced Security Settings page, if you are taking ownership of a folder, select the checkbox next to Replace owner on subcontainers and objects.
9. Click Apply and then click OK.
When you take ownership of a certain file, you need to reopen the Properties. Select OK in the dialogue box that prompts this, and open the Properties again.
To make sure you have all the permissions, you need to follow these following steps:
10. Go to the Advanced Security Settings page, and select Add.
11. In the Permission Entry, click on Select a Principal.
12. In the following Select User or Group, click on Advanced and select Find Now.
13. Locate your username in the search results that follow and click OK.
14. Now click on the checkbox next to Full control under the Basic permissions and click OK.
Now you have full access to the folder or file you just changed the permissions to. You can make any changes you want to the file that you earlier had no access to.
To check if you have all the permissions, you can go to the security tab in the Properties and check for permissions listed to your username.
→ Using Command Prompt
First introduced in Windows Vista, Windows has a command to take ownership of a certain file or folder on your system. You can execute this command if you give administrator privileges to your Command Prompt.
To open an elevated Command Prompt:
1. Press Win + R to open the Run
2. Type cmd.
3. Press Ctrl + Shift + Enter to open cmd in administrator mode.
If you know the location of the file you want to gain access to, you need to put that file name in the command syntax for taking ownership.
The syntax for the command is:
takeown [/S system [/U username [/P [password]]]]
/F filename [/A] [/R [/D prompt]]
Parameter | Definition | What it does |
/S | system | Specifies the remote system to connect to. |
/U | [domain\] user | Specifies the user context under which the command should execute. |
/P | [password] | Specifies the password for the given user context.
Prompts for input if omitted. |
/F | filename | Specifies the filename or directory name pattern. Wildcard “*” can be used to specify the pattern. Allows sharename\filename |
/A | Toggle between administrator and user | Gives ownership to the administrators’ group instead of the current user. |
/R | Toggle Recurse | Instructs tool to operate on files in the specified directory and all subdirectories. |
/D | UAC prompt value | Default answer used when the current user does not have the “list folder” permission on a directory. This occurs while operating recursively (/R) on sub-directories.
Valid values “Y” to take ownership or “N” to skip. |
Examples:
takeown /S system name /U username /P password /F “Myshare\directory” /R /A
takeown /S system /F “C:\Users\USERNAME\Desktop\batch 1.doc” /d y
How To Add Take Ownership In Right-Click And Context Menu?
The GUI and the command line actions can be tedious if you continuously change permissions or need the option handy for the next time you do so. You need to change the registry values to add the take ownership command to the context menu.
Caution: Follow the steps very closely to prevent any mishap. Remember that the registry holds many settings that if wrongly altered can damage your system. It is recommended to back up the registry and your system before you make any of these changes.
1. Open Registry Editor from the Run dialogue by typing regedit and pressing Enter.
2. Navigate to the following path by entering this value in the address bar of the Registry editor:
Computer\HKEY_CLASSES_ROOT\*\shell
3. Right-click on shell in the left pane and create a new Key. Name the key as runas.
4. In the runas key, change the (Default) value. Double click on (Default) and change the Value data to Take ownership.
5. Create a new String value in the runas key. Name the string value as NoWorkingDirectory
6. Create a new sub-key under the runas key. Name the sub-key as command.
7. Double on (Default) in command sub-key, and change the value data to following and click OK:
cmd.exe /c takeown /f \”%1\” && icacls \”%1\” /grant administrators:F
8. Create a new String value in the command sub-key. Name the string value as IsolatedCommand.
9. Double-click on IsolatedCommand and change the value data to the following:
cmd.exe /c takeown /f \”%1\” && icacls \”%1\” /grant administrators:F
10. Click OK and close the Registry Editor.
This adds the Take ownership command in the right-click menu for files.
To add the Take ownership in the context menu of folders, you need to follow these steps:
1. Open Registry Editor again.
2. Navigate to the following directory by entering this value in the address bar of the Registry Editor;
HKEY_CLASSES_ROOT\Directory\shell
3. Right-click on shell in the left pane and create a new Key. Name the key as runas.
4. In the runas key, change the Default value. Double click on (Default) and change the Value data to Take ownership.
5. Create a new String value in the runas key. Name the string value as NoWorkingDirectory
6. Create a new subkey under the runas key. Name the sub-key as command.
7. Double on (Default) in command sub-key, and change the value data to following and click OK:
cmd.exe /c takeown /f \”%1\” /r /d y && icacls \”%1\” /grant administrators:F /t
8. Create a new String value in the command sub-key. Name the string value as IsolatedCommand.
9. Double-click on IsolatedCommand and change the value data to the following:
cmd.exe /c takeown /f \”%1\” /r /d y && icacls \”%1\” /grant administrators:F /t
10. Click OK and close the Registry Editor.
This adds the Take ownership command in the context menu for folders.
Note: if you ever want to reverse these changes at any moment, you can just head to the Registry Editor and delete these runas keys.
Wrapping Up
So, there you have it. Now you know how to take ownership in Windows 10 using the File Explorer and the Command Prompt. I have also shown you how to use the registry editor to bring this command within one click of the file. Comment below if you found these methods useful or have any doubts regarding this post.
J Mullen says
Great!!!
Gets rid of Edge slick and quick
Mainak says
By trying the registry method, it is showing take ownership, both on file and folders. But still I cannot delete the same file and folder. Please help.