Using Takeown.exe Command to take Ownership of a File or Folder

You can change the owner of a file or folder in Windows through the File Explorer GUI (File > Properties > Security > Advanced > Owner > Change) or using the built-in console utility takeown.exe. In this article we will show you how to take ownership of a file or folder from Command prompt using takeown command. Of course, to change the owner of the file you must be the owner or have the administrator’s permissions.

takeown command

Note. Using the takeown command, you can change object ownership and assign it only to the current user or the local administrator group. The command doesn’t allow you to specify an arbitrary user or group as the owner of the directory or file.

Takeown.exe Command

The takeown.exe utility is located in the C:\Windows\System32 directory, so you do not need to specify the full path to it. The takeown command has the following syntax:

takeown /F <file_name> [/S <RemoteComputerName>] [/U <Domain\DomainUserName>] [/P <UserPassword>] [/A] [/R [/D prompt]]

Parameters of the takeown command:

  • /F <file_name>. Here you must specify the full path to the file or directory whose owner you want to change. You can use the wildcard character *;
  • /S <RemoteComputerName>. You can specify the IP address or the name of the remote computer on which you want to execute the takeown command. By default, the command runs on the current computer;
  • /U <Domain\DomainUserName> and [/P <UserPassword>. Used to specify the credentials of the user under which you want to execute the takeown command;
  • /A. Assign to the owner not the current user (from which the command is running), but the local administrators group. If the parameter is not specified, the ownership is assigned to the current user;
  • /R. Recursively change the owners for all nested files and folders in the specified directory;
  • /D {Y | N}. If the current user doesn’t have permission to view the contents of the directory (list files NTFS permissions), this parameter specifies whether to change the owner of the file. Y – change owner, N – skip files.
READ ALSO  GPT or MBR: How to Check HDD Partition Table Style

Full syntax and help on the takeown command can be obtained as follows:

takeown /?


Let’s look at some examples of using the takeown command.
Assign yourself to the owner of the C:\PS directory:

takeown /F "C:\PS"


When executing these command, you will receive a message that you successfully become the owner of a particular objects in the specified folder.

After you have assigned yourself as the owner, you will be able to access the folder. If other users access this folder, you need to check and change the NTFS access permissions using the icacls utility or File Explorer.

Assign yourself to owning the permissions.log file on the remote computer:

takeown /F "C:\permissions.log " /S

Assign a group of administrators to the owner of all text files in the Windows directory:

takeown /F %windir%\*.txt /A

Assign the ownership to the group of local administrators owners at all nested files and folders, skip the directories to which the user doesn’t have access permissions:

takeown /F C:\PS\ /A /R /D Y

Assign current user the owner of all *.docx files in the shared folder Public on the manfs01 file server:

takeown /S manfs01 /F Public \*.docx

Tip. Do not reassign the owner to root system folders (C:\Windows, C:\Program Files, etc.) or for the entire system partition – you can damage your Windows installation.

READ ALSO  How to Fix User Profile Cannot be Loaded in Windows 10?
Cyril Kardashevsky

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.