Home>

The takeown tool allows administrators to regain access to files that were previously denied access in a way that redistributes file ownership,

Help documentation:

takeown [/s system [/u username [/p [password]]]]]

/f filename [/a] [/r [/d prompt]]

description:

This tool allows administrators to regain access to files that were previously denied access by reassigning file ownership.

parameter list:

/s system Specifies the remote system to connect to.

/u [domain \] user specifies the user context,The command executes in this context.

/p [password] Specifies the password for the given user context.If omitted,

Prompt for input.

/f filename Specifies a file or directory name pattern.You can use the wildcard "*"

Specify the mode.Allow share name \ file name.

/a gives ownership to the admins group,Not the current user.

/r recursive:instructs the tool to run in the specified directory and subdirectories

On the file.

/d prompt Use the default answer if the current user does not have "list folders" permission in a directory.When done in a subdirectory

This happens during recursive (/r) operations.Take ownership with valid value "y" or skip with "n".

/?Display this help message.

Note:1) If/a is specified, file ownership is given to the currently logged in user.

2) Mixed mode of "?" and "*" is not supported.

3)/d suppresses confirmation prompts.

Example:

takeown /?

takeown/f lostfile

takeown/f \\ system \ share \ lostfile/a

takeown/f directory/r/d n

takeown/f directory/r/a

takeown/f *

takeown/f c:\ windows \ system32 \ acme.exe

takeown/f%windir%\ *. txt

takeown/s system/f myshare \ acme * .doc

takeown/s system/u user/f myshare \ foo.dll

takeown/s system/u domain \ user/p password/f share \ filename

takeown/s system/u user/p password/f doc \ report.doc/a

takeown/s system/u user/p password/f myshare \ *

takeown/s system/u user/p password/f home \ logon/r

takeown/s system/u user/p password/f myshare \ directory/r/a

Here are some examples:

Forcibly change the owner of all files and folders and subfolders in the current directory to the administrators command:

takeown/f */a/r/d y

Change the ntfs permissions of all files and subfolders in the d:\ documents directory to only the administrators group (administrators) full control (remove all the original ntfs permission settings):

cacls d:\ documents \ *. */t/g administrators:f

Add the full control permissions of the administrators (administrators) to the ntfs permissions of the files and subfolders in the original d:\ documents directory (do not delete all the original ntfs permission settings):

cacls d:\ documents \ *. */t/e/g administrators:f

Cancel the full control permissions of the administrators group (not delete all the original ntfs permission settings):

cacls \\ server \ documents \%username%\ My Documents/t/e/r "mddq \ domain admins"

cacls \\ server \ documents \%username%\ desktop/t/e/r "mddq \ domain admins"

Through these two commands, you can achieve batch control of folder and file owner permissions and add administrator group full control permissions.