How To Use The Takeown Command In Windows (2027)
Takeown makes you the owner of a file or folder, which is often the first step when Windows says you were denied access.
The basic form is takeown /f , and adding /r covers every file inside a folder.
This guide follows Microsoft’s takeown and icacls references, so each switch below is documented.
Table of Contents
- Takeown quick answers
- What takeown does
- Be careful with ownership changes
- Open Command Prompt as administrator
- The takeown syntax
- Takeown switches at a glance
- Take ownership of one file
- Give ownership to the Administrators group
- Take ownership of a folder and its contents
- Choose Y or N for the /d prompt
- Wildcard limits
- Grant yourself full permissions afterward
- Permission letters you can use with icacls
- Save permissions before you change them
- Use takeown on another computer
- Mistakes that stop takeown from working
- Take ownership and get access step by step
- Related guides
- Official sources
- More Windows guides
Takeown quick answers
| I want to | Type this |
|---|---|
| Take ownership of a file | takeown /f lostfile |
| Give ownership to the Administrators group | takeown /f |
| Take ownership of a folder and everything in it | takeown /f |
| Answer the folder prompt automatically | takeown /f |
| Then grant yourself full permissions | icacls |
Replace the placeholders with your own path, and put quotes around any path that contains a space.
What takeown does
Microsoft describes takeown as a command that lets an administrator recover access to a file that was previously denied, by making the administrator the owner.
It lists Windows 11 and Windows 10 as supported versions.
Owning a file is not the same as having permission to change it, which is why the permission step further down matters.
Be careful with ownership changes
Take ownership only of files and folders that belong to you or that you have a clear reason to change, and keep a backup of anything important first.
Microsoft says that takeown with /d Y replaces a directory’s permissions with full control for you only.
For checking damaged system files without changing ownership, see the SFC and DISM guide.
Open Command Prompt as administrator
- Press the Windows key and type cmd.
- Right-click Command Prompt and choose Run as administrator.
- Type your takeown command and press Enter.
The steps for an elevated window are in how to open Terminal as administrator.
The takeown syntax
Microsoft gives the syntax as takeown [/s .
The only required part for a local file is /f followed by the file or folder name.
Takeown switches at a glance
| Switch | What it does |
|---|---|
/f | Sets the file or directory name pattern, and you can use the * wildcard. |
/a | Gives ownership to the Administrators group instead of the current user. |
/r | Works on all files in the directory and its subdirectories. |
/d {Y|N} | Answers the prompt shown when you lack List Folder and Read permissions, and it must be used with /r. |
/s | Names a remote computer, with no backslashes, and the default is the local computer. |
/u and /p | Run the command with another user account and its password. |
Take ownership of one file
- Open an elevated Command Prompt.
- Run
takeown /f "C:\Path\to\file.txt"with your own path. - Watch for an error message, and if one appears, check the path and that the window is elevated.
Microsoft’s own example is takeown /f lostfile.
By default, ownership goes to the user who is currently logged on.
Give ownership to the Administrators group
Add /a when you want the Administrators group to own the item instead of your account.
Microsoft says that without this option, ownership goes to the user currently logged on to the computer.
Take ownership of a folder and its contents
Use /r to run the operation on every file in the folder and its subfolders.
A folder example is takeown /f "D:\Old Files" /r, with the path as a placeholder.
If you lack List Folder and Read permission on a subfolder, takeown asks what to do unless you add /d.
Choose Y or N for the /d prompt
| Value | What happens |
|---|---|
Y | Takes ownership of the directory, and its permissions are replaced with permission granting you full control only. |
N | Skips the directory. |
Microsoft requires the /d option to be used together with /r.
Wildcard limits
Microsoft says the * wildcard works in the /f pattern.
Mixed patterns that use both ? and * are not supported by takeown.
Grant yourself full permissions afterward
Microsoft notes that after takeown, you might have to use Windows Explorer to give yourself full permissions before you can delete the files and directories.
The icacls command does the same from the command line.
| icacls option | What it does |
|---|---|
/grant | Grants full access, and without :r the permission is added to existing explicit permissions. |
/setowner | Changes the owner of all matching files to the user. |
/T | Applies the operation to files in the folder and its subfolders. |
/C | Continues even if file errors occur. |
/reset | Replaces ACLs with the default inherited ACLs. |
Permission letters you can use with icacls
| Letter | Access it gives |
|---|---|
F | Full access. |
M | Modify access. |
RX | Read and execute access. |
R | Read-only access. |
W | Write-only access. |
D | Delete access. |
N | No access. |
Pick the smallest permission that does the job, such as M to change files or RX to open them.
Microsoft says SIDs can be friendly names or numerical values prefixed with an asterisk.
Save permissions before you change them
Run icacls to store the current permissions in a file.
Microsoft documents /restore as the option that applies the stored permissions to the files in a directory.
Microsoft’s example saves the permissions for everything under a folder with /t and restores them with icacls .
Use takeown on another computer
The /s switch names a remote computer by name or IP address, without backslashes.
The /u switch runs the command under another account, and the default is system permissions.
Most home users never need these switches, since the default is the local computer.
Mistakes that stop takeown from working
- Running it in a window that is not elevated.
- Using a mixed
?and*pattern, which Microsoft says is not supported. - Using
/dwithout/r, since Microsoft requires them together. - Expecting ownership alone to let you delete the file, when you may still need to grant full permissions.
Take ownership and get access step by step
- Open an elevated Command Prompt.
- Run
takeown /f, adding/rfor a folder. - Run
icacls, adding/grant :F /Tfor a folder. - Try the action that was denied before, such as opening or deleting the item.
Microsoft’s icacls page also offers /save to store permissions first, and /restore to apply them again.
Related guides
For the Explorer route to the same problem, see how to fix folder access denied in Windows 11.
For copying files you now own, see the Robocopy guide.
Official sources
The switches and example come from Microsoft’s takeown reference.
The permission options come from Microsoft’s icacls reference.
More Windows guides
- How To Use The Icacls Command In Windows (2026)
- How To Use The Mklink Command In Windows (2026)
- How To Use The Runas Command In Windows (2026)
- How To Use The Findstr Command In Windows (2026)
- How To Use The Setx Command In Windows (2026)
- How To Use The Reg Add Command In Windows (2027)
See all: Windows 11 Guides