Forcibly change all files and folders in the current directory and the owner of subfolders to administrators. command:
Takeown/f */a/r/d y
Change the NTFS permissions of all files and subfolders in the d: \ documents ents directory to full control only for administrators (delete all NTFS permission settings ):
Cacls d: \ Administrative ents \ *. */T/G administrators: F
Add the Administrator group (administrators) with full control permissions on the NTFS permissions of files and subfolders in the original d: \ documents ents directory (do not delete all the original NTFS permission settings ):
Cacls d: \ Administrative ents \ *. */T/E/G administrators: F
Cancel the full control permissions of the Administrator group (do 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"
These two commands can be used to obtain the full control permissions of folders, file owners, and add administrator groups in batches.
C: \ Documents and Settings \ Administrator> takeown /?
TAKEOWN [/S system [/U username [/P [password]
/F filename [/A] [/R [/D prompt]
Description:
This tool allows the Administrator to re-obtain the previously denied access by re-assigning the file ownership.
.
Parameter List:
/S system specifies the remote system to connect.
/U [domain \] user specifies the user context, and the command is executed in this context.
/P [password] specifies the password for the given user context. If omitted,
Prompt input.
/F filename specifies the file name or directory name mode. You can use the wildcard "*"
Specify the mode. Share Name \ file name is allowed.
/A gives ownership to the Administrator group instead of the current user.
/R recursion: indicates that the tool runs in the specified directory and subdirectory.
.
/D prompt the current user does not "list Folders" in a directory"
Use the default answer when the permission is set. When performed in a subdirectory
This happens during recursive (/R) operations. Valid
Value "Y" to obtain ownership or use "N" to skip.
/? Displays the help message.
Note: 1) If/A is specified, the file ownership will be given to the currently logged-on user.
2 "? "And.
3)/D is used to suppress the confirmation prompt.
Example:
TAKEOWN /?
TAKEOWN/F lostfile
TAKEOWN/F \ system \ share \ lostfile/
TAKEOWN/F directory/R/D N
TAKEOWN/F directory/R/
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/
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/