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

Parameters

ParameterDescription
/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.
/aGives ownership to the Administrators group instead of the current user.
/rPerforms 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.

Example

takeown /f "c:\folder\subfolder" /r

Leave a Reply