This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
Enables an administrator to recover access to a file that previously was denied, by making the administrator the owner of the file. This command is typically used on batch files.
takeown [/s <computer> [/u [<domain>\]<username> [/p [<password>]]]] /f <filename> [/a] [/r [/d {Y|N}]]| Parameter | Description |
|---|---|
/s<computer> | Specifies the name or IP address of a remote computer (do not use backslashes). The default value is the local computer. This parameter applies to all of the files and folders specified in the command. |
/u[<domain>\]<username> | Runs the script with the permissions of the specified user account. The default value is system permissions. |
/p[<[password>] | Specifies the password of the user account that is specified in the/u parameter. |
/f<filename> | Specifies the file name or directory name pattern. You can use the wildcard character* when specifying the pattern. You can also use the syntax<sharename>\<filename>. |
| /a | Gives ownership to the Administrators group instead of the current user. If you don't specify this option, file ownership is given to the user who is currently logged on to the computer. |
| /r | Performs a recursive operation on all files in the specified directory and subdirectories. |
/d{Y | N} | Suppresses the confirmation prompt that is displayed when the current user does not have theList Folder andRead permissions on a specified directory, and instead uses the specified default value. Valid values for the/d option are:
|
| /? | Displays help at the command prompt. |
Mixed patterns using (? and*) aren't supported bytakeown command.
After deleting the lock withtakeown, you might have to use Windows Explorer to give yourself full permissions to the files and directories before you can delete them.
To take ownership of a file namedLostfile, type:
takeown /f lostfileWas this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?
Was this page helpful?
Want to try using Ask Learn to clarify or guide you through this topic?