How to Change File or Folder Ownership Using the Takeown Command

You try to delete a leftover folder from an old Windows install and get “Access denied.” You open a file from a rescued hard drive and Windows says you do not have permission. In both cases the fix is the same: you need to become the owner first. That is what the takeown command does, and this guide walks the whole procedure, including the follow-up step most tutorials leave out.

Ownership vs Permissions: The Distinction That Matters

Every file and folder on an NTFS drive has an owner, and separately, a list of permissions saying who may read, write, or delete it. These are two different things. takeown changes only the owner. Becoming the owner gives you the right to change the permissions, but it does not automatically grant you access. That is why step two of this procedure uses icacls to grant yourself full control afterward. Skip that step and you will own a file you still cannot open.

Concept diagram comparing file ownership versus permissions in Windows: the owner controls the file while permissions decide who can read, write, or execute, with ownership coming first
Ownership first, permissions second. Takeown handles the first half; icacls handles the second.

Step 1: Open an Elevated Command Prompt

takeown only works with administrator rights. Press the Windows key, type cmd, right-click Command Prompt, and choose Run as administrator. Click Yes on the User Account Control prompt. If the window title does not say “Administrator,” close it and try again: without elevation every command below will fail.

Step 2: Take Ownership

The basic pattern is takeown /f followed by the path. Here are the variations you will actually use, from simplest to most thorough.

Take ownership of a single file

takeown /f "D:\Photos\old-backup.zip"

Use quotes around any path containing spaces. On success you will see: SUCCESS: The file (or folder) is now owned by your user account.

Take ownership of a folder and everything inside it

takeown /f "D:\OldWindows" /r /d y

The /r flag recurses through all subfolders and files. The /d y flag auto-answers “yes” to the confirmation prompt that appears when you lack list permission on a directory, so a big job runs unattended. Expect one success line per object; on a large folder that is a lot of scrolling text, which is normal.

See also  How to Reset Network Settings in Windows 11 (What Gets Wiped)

Give ownership to the Administrators group instead of yourself

takeown /f "D:\Shared" /a /r /d y

The /a flag assigns ownership to the local Administrators group rather than your personal account. Prefer this for shared folders or anything another admin might need to manage later: it keeps recovery repeatable instead of tying the folder to one person.

Parameter Reference

ParameterWhat it doesWhen to use it
/fSpecifies the file, folder, or pattern to take ownership ofEvery takeown command; wildcards and UNC paths allowed
/rRecurses through all subfolders and filesWhole-folder takeovers, old installs, rescued drives
/aGives ownership to the Administrators groupShared resources, servers, anything another admin may touch
/d yAuto-answers yes to permission promptsUnattended runs on folders you cannot currently list
/s, /u, /pTarget a remote computer with credentialsAdministering another PC on your network
Reference card showing the four main takeown command parameters: /f for the path, /r for recursive, /a for the Administrators group, and /d Y to auto-answer prompts
The four flags that cover nearly every takeown job: /f, /r, /a, and /d.

Step 3: Grant Yourself Permissions with icacls

This is the step most guides skip, and the reason people report that “takeown did not work.” Ownership alone does not open the file. Grant full control now:

icacls "D:\OldWindows" /grant administrators:F /t

The /t flag applies it through all subfolders, matching the recursive takeover. Replace administrators with your username if you took personal ownership in step 2. After this command, you can read, modify, or delete the files normally.

Step 4: Verify It Worked

  • Run icacls "D:\OldWindows" and check that your account or Administrators shows (F) for full control.
  • Run dir /Q "D:\OldWindows" to display the owner of each item in the listing.
  • Simply try the operation that failed before: delete, move, or open the file. If it works, you are done.
See also  Best Cryptocurrency Apps for Beginners: A Practical Guide to Getting Started

When Not to Use Takeown

takeown is safe on your own data, but reckless on the operating system. Do not run it recursively on C:\, C:\Windows, or C:\Program Files. Changing ownership of system files can break updates, Windows Security, and installed programs in ways that are painful to undo. If Windows itself is denying you access to a system location, that is usually the system protecting you, not a problem to bulldoze through.

Also note the difference between “access denied” and other errors. If a file is locked because a program has it open, ownership will not help; see our guide to fixing the file is open in another program error instead. And if you are fighting impossibly long paths rather than permissions, the destination path too long fix is the right tool.

Our Take

takeown plus icacls is the correct two-punch combination for reclaiming files from old installs, rescued drives, and deleted user accounts. Use /a for anything shared, always follow up with the grant, and keep it away from Windows system folders. If you are recovering data from a failing drive rather than fighting permissions, read our guide to recovering deleted files in Windows before you touch anything.

Scroll to Top