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

The idea of ownership of a file or folder in Windows 10 or any Windows version for that matter may sound odd to a regular user. You may think that if you own a computer, you own files inside it. Theoretically, that is true. Your computer means your files. But things are a bit different in reality. Sometimes, when trying to change some system files and folders, you may see the following message: You do not currently have permission to access this folder. To deal with that problem, you need to know how to utilize the takeown.exe command in Windows 10/11 or Windows Server.

You can change the owner of a file or folder in Windows using File Explorer. Select a file or folder for which you want to change the owner. Right-click it and select Properties. Go to Security > Advanced > Owner > Change > and select the user or security group that you want to make the owner of the object.

takeown command

Also, you can use the built-in console utility takeown.exe. In this article, we will show you how to take ownership of a file or folder from the Command prompt using the takeown command. Of course, to change the owner of a file, you must be the owner or have the administrator’s permissions.

Note. With the takeown command, you can change object ownership and assign it only to the current user or the local administrator group. It does not allow you to specify an arbitrary user or group as the owner of the directory or file.

Takeown.exe Command

Where to find the takeown.exe utility in Windows 10? In Windows 10 and some older versions, the takeown.exe utility “lives” in the C:\Windows\System32 directory. You do not need to specify the full path to it in the Command prompt. The takeown command has the following syntax:

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

takeown.exe

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 a local computer (your PC);
  • /U <Domain\DomainUserName> and [/P <UserPassword>. Use that part of the command to specify the credentials of the user under which you want to execute the takeown command;
  • /A. This command gives ownership to the administrator group instead of the current user. If the parameter is not specified, object ownership will be assigned to the current logged-on user;
  • /R. Recursively change the owners for all nested files and folders in the specified directory;
  • /SKIPSL — if the directory has symbolic links to files or folders, ignore them and do not change the owner of the target files (used only with /R);
  • /D {Y | N}. If the current user does not 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 the owner, N — skip files.

You can also find the list of all parameters for the takeown.exe utility by typing in the takeown /? command in the Command prompt. You will find brief explanations on how takeown.exe works, plus some examples.

To make things clearer, here are some examples of using the takeown.exe utility to change the ownership of files and folders in Windows 10 (or any modern Windows version.)

To make yourself the owner of, for example, the C:\PS directory, enter the following command:

takeown /F "C:\PS"

windows change owner command line

After executing the command, you will receive a message that you successfully became the owner of particular objects in the specified folder.

“SUCCESS: The file (or folder): “filename” now owned by user “Hostname\Username”.”

or

SUCCESS: The file (or folder): “filename” now owned by the administrators group.

You can display the current owner of a folder or all nested objects with the command:

dir c:\ps /q

The command returned a list of objects of the file system in the specified folder and their owners.

takeown

You can also get the owner of a file or folder using the Get-ACL PowerShell cmdlet:

Get-Acl "C:\PS\ip_list.txt" | Select-Object Owner

take ownership command

With a simple ForEach loop, you can recursively list all files in a given folder by their owners:

Get-ChildItem C:\ps -recurse | ForEach-Object{Get-Acl $_.FullName|select path,owner}

Now you can open and manage previously inaccessible folders. If other users access this folder, you need to check and change the NTFS access permissions using the icacls tool or File Explorer.

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

lonPC2213.theitbros.com:

takeown /F "C:\permissions.log " /S lonPC2213.theitbros.com

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

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

Assign the ownership to the group of local administrators for all nested files and folders, and skip the directories to which the user has access permissions:

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

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

takeown /S manfs01 /F Public \*.docx

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

Sometimes you won’t be able to take ownership of a certain file or folder, even under a local administrator account. You will face INFO: Access is denied error.

In this case, you can try running the takeown command as the NT AUTHORITY\SYSTEM account. To do this, you need to use the psexec tool.

  1. Download the PSTools archive and extract it to a directory on the local drive;
  2. Open command prompt as an administrator and navigate to PSTools directory:
    cd c:\tools\pstools
  3. To run the command line as the System account, run the command:
    PsExec.exe -ids cmd.exe

    takeown cmd

  4. A command prompt window will open. Check that it is running under the NT AUTHORITY\SYSTEM account:
    whoami
    cmd takeown
  5. Now you can change the owner of any file or folder using the takeown.exe command

One disadvantage of the takeown command is that it doesn’t allow you to set the ownership of a folder or file to another user. You can make the owner only yourself or the built-in Administrators group.

If you want to make a specific user the owner of a folder and all objects (recursively), you need to use the icacls command:

icacls c:\ps\* /setowner bjackson /T /C /L /Q

How to Quickly Take the Ownership of a File or Folder in Windows 10?

You can use a third-party tool called TakeOwnershipPro to place a dedicated option in the context menu in File Explorer. That utility will provide you with a quick and simple way to change the owner of a file or folder in Windows 10 without using complex commands. You can download the app for free on majorgeeks.com.

I enjoy technology and developing websites. Since 2012 I'm running a few of my own websites, and share useful content on gadgets, PC administration and website promotion.
Latest posts by Cyril Kardashevsky (see all)

2 comments

  1. Access denied memory card. Access denied displayed in a camera. After that windows can’t access the SD card

  2. Brilliant page – very good description. Friend of mine was moaning not much info on net about Takeown.exe – so I strongly berated him and told him to look at this site…

Leave a Reply

Your email address will not be published.

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