Takeown
Updated: January 21, 2005
Syntax
Parameters
Remarks
- To perform this procedure, you must be a member of the Administrators group on the local computer, or you must have been delegated the appropriate authority. If the computer is joined to a domain, members of the Domain Admins group might be able to perform this procedure. As a security best practice, consider using Run as to perform this procedure.
- This command is typically used in batch files.
- Using the /s, /u, and /p command-line options The /u and /p command-line options are available only when you use /s. You must use /p with /u to provide the user's password.
- If /a is not specified then file ownership is given to the user who is currently logged on to the computer.
- Mixed patterns using the question mark (?) and the wildcard character (*) is not supported.
- If you install a Windows Server 2003 operating system on a computer with another Windows Server 2003 operating system already installed and then attempt to delete it, you cannot delete the entire directory. One of the hidden directories, named \Installer, contains some .msi and .ico files that are locked, and you have to format the drive to delete them. This is because the Windows Server 2003 operating systems apply security attributes to the file so that the only the System account of the previous installation can access the files. Even an administrator of this computer cannot reset these permissions. You must run takeown to delete these files.
- After deleting the lock with takeown, you might have to use Windows Explorer or cacls to give you full permissions to the files and directories before you can delete them. For more information about cacls, see Related Topics.
Examples
takeown /f lostfile
Formatting legend
Format | Meaning |
Italic | Information that the user must supply |
Bold | Elements that the user must type exactly as shown |
Ellipsis (...) | Parameter that can be repeated several times in a command line |
Between brackets ([]) | Optional items |
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one |
Courier font | Code or program output |