Takeown


Applies To: Windows 7,Windows Server 2003 R2,Windows Server 2003,Windows Vista,Windows Server 2003 with SP2,Windows Server 2008,Windows Server 2008 R2,Windows Server 2003 with SP1

Enables an administrator to recover access to a file that previously was denied, by making the administrator the owner of the file.

For examples of how to use this command, see Examples.

Syntax


Copy Code

takeown [/s <Computer> [/u [<Domain>\]<User name> [/p [<Password>]]]] /f <File name> [/a] [/r [/d {Y|N}]]

Parameters

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>\]<User name>

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 <File name>

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.

/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 the "List Folder" permission on a specified directory, and instead uses the specified default value. Valid values for the /d option are as follows:

  • Y: Take ownership of the directory.

  • N: Skip the directory.

Note that you must use this option in conjunction with the /r option.

/?

Displays help at the command prompt.

Remarks

Examples

To take ownership of a file named Lostfile, type:


Copy Code

takeown /f lostfile

Additional references

Command-Line Syntax Key