Windows

How to Take Ownership of a File in Windows: 3 Simple Ways

This guide explains how to take ownership of files or folders in Windows 10/11 using File Explorer, PowerShell, and Command Prompt. Resolve 'Access Denied' errors and gain full control over system or other users' files.

Updated at February 16, 2026
5-10 min
Easy
FixPedia Team
Применимо к:Windows 10Windows 11Windows Server 2016+

Introduction / Purpose

In Windows, every file and folder has an owner—a user account that can freely modify permissions. When files are created by other users, programs, or the system (such as TrustedInstaller), you may encounter an "Access Denied" error even if you are an administrator.

Taking ownership is the process of changing an object's owner to your user account. After this, you will be able to:

  • Modify, rename, or delete the file.
  • Assign access permissions to other users.
  • Edit system configurations (e.g., the hosts file).

In this guide, we will cover three reliable methods: via the graphical interface, PowerShell, and the command line.

Requirements / Preparation

  1. A user account with administrator privileges—changing ownership is impossible without them.
  2. The path to the file/folder—for example, C:\Windows\System32\drivers\etc\hosts.
  3. Understanding the risks—do not change the owner of critical system files unnecessarily. It is recommended to create a backup before proceeding.
  4. Access to PowerShell or Command Prompt (CMD) with administrator privileges—for console-based methods.

Step 1: Taking Ownership via File Explorer

This method is suitable for one-off operations on a specific file.

  1. Locate the desired file or folder in File Explorer.
  2. Right-click on it → "Properties".
  3. Go to the "Security" tab → click "Advanced".
  4. In the "Owner" section, click "Change".
  5. In the window that appears, enter your username (e.g., Administrator) or click "Advanced""Find Now" to select a user account.
  6. Click "OK".
  7. Important: In the same "Advanced Security Settings" window, check the box "Replace owner on subcontainers and objects" if you want to apply the changes to all nested files and folders.
  8. Click "OK""OK""OK" to close all windows.

You are now the owner. However, you may still lack permissions to make changes. For that, we will grant permissions in Step 3.

Step 2: Using Command Prompt (CMD) or PowerShell

Console methods are faster for bulk operations or system files.

Method A: The takeown Command

The takeown utility changes the owner to the current user (or a specified user account).

Example 1: Take ownership of a file

takeown /F "C:\path\to\file.txt"

Example 2: Take ownership of a folder and all its contents (recursively)

takeown /F "C:\path\to\folder" /R /D Y
  • /F — path to the file/folder.
  • /R — recursively (for all nested objects).
  • /D Y — automatically confirm access prompts (useful in scripts).

Example 3: Specify a particular user (e.g., AdminUser)

takeown /F "C:\path\to\file.txt" /U "AdminUser"

⚠️ Important: The takeown command only changes the owner but does not grant Write permissions. After running it, Step 3 with icacls is almost always necessary.

Method B: The icacls Command

The icacls utility allows flexible management of permissions (ACL). After changing ownership via takeown, run:

Grant the current user full control

icacls "C:\path\to\file.txt" /grant "%USERNAME%":F
  • %USERNAME% — automatic substitution of your login name.
  • :F — full control flag.

Grant permissions recursively for a folder

icacls "C:\path\to\folder" /grant "%USERNAME%":F /T /C
  • /T — recursively through all subfolders.
  • /C — continue on errors (skip inaccessible files).

Reset all permissions and set new ones (use with caution!)

icacls "C:\path\to\file.txt" /reset

This command removes all existing ACLs and replaces them with standard ones inherited from the parent folder.

Step 3: Combined Script for Full Control

For a quick solution, you can combine takeown and icacls into a single script.

Create a file named take_ownership.ps1 in PowerShell:

param(
    [Parameter(Mandatory=$true)]
    [string]$Path
)

# 1. Take ownership
takeown /F $Path /R /D Y | Out-Null

# 2. Grant full control to the current user
icacls $Path /grant "$env:USERNAME":F /T /C | Out-Null

Write-Host "Ownership and permissions obtained for: $Path" -ForegroundColor Green

How to use:

  1. Save the script.
  2. Launch PowerShell as an administrator.
  3. Run:
    .\take_ownership.ps1 -Path "C:\your\path"
    

Step 4: Verify the Result

  1. Return to File Properties → Security → Advanced.
  2. The "Owner" field should display your username.
  3. On the "Security" tab, in the list of groups/users, find your account and ensure the permission "Full Control" is set.
  4. Try to modify, rename, or delete the file—access errors should no longer occur.

Potential Issues

Issue: "Access Denied" when running commands

  • Solution: Launch PowerShell or CMD as an administrator (right-click → "Run as administrator").

Issue: File locked by the system (e.g., C:\Windows\System32\...)

  • Solution: For system files, you may need to stop the corresponding service or boot into Safe Mode. Use takeown with the /A switch (take ownership for the Administrators group).

Issue: File becomes inaccessible again after taking ownership

  • Cause: Restrictions on the parent folder override the permissions.
  • Solution: On the parent folder (higher in the hierarchy), uncheck "Replace all child object permission entries..." in "Advanced Security Settings" or use icacls with the /inheritance:r switch to disable inheritance, then explicitly set permissions.

Issue: icacls outputs "No access" error

  • Solution: Ensure you actually became the owner (Step 1 or takeown). Sometimes you need to restart File Explorer or the computer to refresh the access token.

Issue: Cannot take ownership of a file in C:\Program Files

  • Cause: This folder is protected by Windows Resource Protection (WRP).
  • Solution: For changes in Program Files, use deployment via an installer or temporarily disable UAC (not recommended). Instead of directly editing configuration files, use the appropriate APIs or the registry.

F.A.Q.

Why won't Windows let me modify a system file even if I'm an administrator?
Can I restore the original owner of a file?
What's the difference between taking ownership via PowerShell and CMD?
Is this dangerous? Could I break the system?

Hints

Identify the problematic file or folder
Use File Explorer (the easiest method)
Apply PowerShell or CMD commands
Verify access permissions
FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community