Sometimes, you may need to edit or delete system files in Windows that are owned by TrustedInstaller, SYSTEM, or another administrator. The administrator must first take ownership of these objects to access such files. The owner of a file or folder can be changed in the object properties in the File Explorer GUI or by using the built-in command line tool Takeown.exe.
Warning. You should avoid permanently changing ownership of critical Windows system files and folders unless absolutely necessary. Many protected system files are intentionally owned by TrustedInstaller to prevent accidental modification. Note that incorrect ownership or permissions may break Windows updates, System File Checker (SFC), DISM repair operations, or app servicing.
What is Takeown.exe?
Takeown.exe is a Windows CLI tool (located in the %windir%\System32 directory) that allows you to change the ownership of a file or folder on a local or remote computer. Only the current user or the Administrators group can be assigned as the owner. Takeown doesnโt support assigning an arbitrary user as the file system object owner.
Basic Syntax of the Takeown Command
The basic syntax of the takeown command looks like this:
TAKEOWN [/S system [/U username [/P [password]]]] /F filename [/A] [/R [/D prompt]]

Takeown Command Key Options and Parameters Explained
Let’s look at the main tool options:
- /F โ the full path to the file or directory whose owner you want to change. Supports wildcards.
- /R โ recursively change the owner of the specified directory and all its subdirectories.
- /S โ allows you to specify the name of the remote computer where you want to change the owner of a file or folder.
- /U <Domain\DomainUserName> and [/P <UserPassword>] โ used to specify the user credentials with which the command will be executed.
- /A โ set the owner to the Administrators group instead of the current user.
- /D {Y|N} โ used to suppress the confirmation prompts. When set to y, it assumes โYesโ as the answer to all prompts.
Examples of Using Takeown.exe
The following examples demonstrate how to use the takeown command to change the ownership of files and folders in Windows.
Notes
- In order to change the owner, your account must have local administrator permissions.
- After the ownership changes, you need to edit the ACL of the object to have permissions to edit or delete files or folders.
- NTFS permissions, including the owner attribute, are only available for drives formatted with NTFS or ReFS. Note that some NTFS-specific features and ACL behaviors may differ on ReFS volumes depending on the Windows Server version.
Ownership vs NTFS Permissions
Keep in mind that changing the owner of a file/folder does not automatically grant full access permissions. Ownership only allows the owner to modify the object permissions (ACL). To read, modify, or delete files, you may still need to explicitly grant NTFS permissions using tools such as Icacls.
Take Ownership from TrustedInstaller
Many protected Windows system files and folders are owned by the TrustedInstaller service account instead of Admins. This is part of Windows Resource Protection (WRP), which helps prevent accidental/unauthorized modification of critical OS components.
Files owned by TrustedInstaller are commonly protected because they are required for Windows boot, updates, drivers, system recovery, or built-in apps. Attempting to modify these files without changing ownership may result in an โAccess is deniedโ error even for admins.
Typical use cases
When troubleshooting Windows issues, replacing drivers, editing the Hosts file, removing corrupted files, or performing advanced system customization, you may temporarily take ownership of TrustedInstaller-protected files. Run the command:
takeown /f "C:\Windows\System32\drivers\etc\hosts"
This example takes ownership of the Windows Hosts file from TrustedInstaller and assigns it to the current user.
Take ownership of a single file
To take ownership of a file, open an elevated cmd prompt and run the command:
takeown /f "C:\path\to\file.ext"

This command changes the ownership of the file to the user who is currently logged on.
Assign ownership to the Administrators group
To change the owner to the local Administrators group, add the /A option:
takeown /f "C:\path\to\file.ext" /A

To verify file (folder) owner, use the dir /q command:
dir "C:\path\to\folder" /q

Take ownership of multiple files at once
Modify the ownership of all TXT files located in a specific directory:
takeown /F C:\DOCS\*.txt /A
Change folder owner:
takeown /f "C:\path\to\folder"
To recursively change the ownership of a folder and all its contents to the Administrators group without prompting for confirmation:
takeown /f "C:\path\to\folder" /A /r /d y

Taking Ownership on a Remote Computer
To take ownership of the file C:\demo\computers.txt on the remote computer DC1:
takeown.exe /f C:\demo\computers.txt /s DC1

Note. Remote Takeown operations require admin permissions on the remote machine. File and Printer Sharing, Remote UAC policies, and RPC access must also allow remote admin operations.
Using Icacls After Takeown for Permissions
After changing the owner of a folder, you can assign new NTFS permissions. The ICACLS command can be used for this.
Granting full control with icacls
For example, to grant your account full control over a folder, run the following command:
icacls c:\Docs\ /grant "%USERDOMAIN%\%USERNAME%":(F) /t

Note. The icacls command can also be used to change the owner of a directory or folder. Unlike the Takeown command, Icacls lets you assign ownership to any specified user, not just the current one. For example:
icacls c:\ps\ /setowner user123 /C /L /Q /TAfter modifying protected Windows file/folders, you may want to restore the ownership back to TrustedInstaller. This helps preserve the default Windows security model and prevents potential problems with Windows Update, SFC, DISM, and app servicing. The command below restores the original TrustedInstaller ownership for the specified file/folder:
icacls "C:\Windows\System32\file.dll" /setowner "NT SERVICE\TrustedInstaller"In order to restore TrustedInstaller ownership recursively for an entire folder and all its contents, use the following command:
icacls "C:\Windows\SomeFolder" /setowner "NT SERVICE\TrustedInstaller" /T /C
Takeown vs Icacls
| Feature | Takeown | Icacls |
|---|---|---|
| Change file/folder owner | Yes | Yes |
| Assign arbitrary owner | No | Yes |
| Modify NTFS permissions | No | Yes |
| Recursive operations | Yes | Yes |
| Change ACL entries | No | Yes |
| Grant Full Control permissions | No | Yes |
| Built into Windows | Yes | Yes |
| Best used for | Ownership changes | Permissions and ACL management |
In most cases, admins use Takeown to become the owner of a protected file/folder and then use Icacls to grant the required NTFS permissions.
Troubleshooting Takeown.exe Errors
If the Takeown.exe command fails with the message INFO: Access is denied even when you are running an elevated Command Prompt, the object may have restrictive NTFS permissions (DACL) that prevent members of the local Administrators group from taking ownership. This situation is common with protected system files and folders owned by TrustedInstaller/SYSTEM.
In such cases, you can run Takeown.exe under the NT AUTHORITY\SYSTEM security context, which often has the permissions required to take ownership of protected files and folders.
Fixing โAccess is deniedโ error
In order to change the owner of a file, you must run the Takeown command with NT AUTHORITY\SYSTEM privileges. The PSExec utility can be used for this purpose.
- Download the PSTools archive and extract it to a directory on the local drive. In this example, it is extracted to โC:\tools\pstoolsโ.
- Open the command prompt as an administrator and navigate to the PSTools directory:
cd c:\tools\pstools
- Start an instance of cmd.exe as the System account by running this command:
PsExec.exe -ids cmd.exe

Warning. Note that running a command prompt under the SYSTEM account provides full local privileges. You should use this method carefully and only on trusted systems.
- Now, you can run Takeown.exe in the new instance of the command prompt:
takeown /f "C:\demo\dir1\dummy_file.txt"

Best Practices for Using Takeown
- You should avoid changing ownership of Windows system folders permanently
- You should use Icacls after Takeown to grant permissions
- Prefer least privilege access
- Don’t forget to restore TrustedInstaller ownership when finished
- You need to test recursive changes carefully
- You must use backups before mass ownership modifications
What is Takeown.exe in Windows?
Takeown.exe is a built-in Windows command-line utility that allows administrators to change the ownership of files and folders. It is commonly used when access to protected files is blocked because the objects are owned by TrustedInstaller, SYSTEM, or another user.
What does the Takeown command do?
The takeown command changes the ownership attribute of a file or folder. After becoming the owner, you can modify the objectโs NTFS permissions and gain access to the file or directory.
Can Takeown assign ownership to another user account?
No. Takeown.exe can only assign ownership to the current user or the Administrators group. If you need to assign ownership to another user, use Icacls instead.
What is the difference between Takeown and Icacls?
Takeown is mainly used to change ownership of files and folders, while Icacls is used to manage NTFS permissions and ACLs. Icacls also supports assigning ownership to arbitrary users and modifying access control entries.
Why does Takeown return โAccess is deniedโ?
The error usually appears when the file is currently open, locked by another process, or protected by SYSTEM-level permissions. In some cases, you may need to run Command Prompt under the NT AUTHORITY\SYSTEM account using tools such as PsExec.

Access denied memory card. Access denied displayed in a camera. After that windows can’t access the SD card
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…
I did this so I could try and replace ntdll.dll to fix a game crash, but I was still denied permission… as the sole user on my computer.