http://support.microsoft.com/kb/825751
示例
下列 Xcacls.vbs 命令提供 Xcacls.vbs 用法的一些示例:
xcacls.vbs c:\test\ /g domain\testuser1:f /f /t /e
该命令可编辑现有权限。它授予 Domain\TestUser1 完全控制 C:\Test 下所有文件的权限,遍历 C:\Test 下的子文件夹,然后更改找到的所有文件。该命令不触及目录。
xcacls.vbs c:\test\ /g domain\testuser1:f /s /l "c:\xcacls.log"
该命令可替换现有权限。它授予 Domain\TestUser1 完全控制 C:\Test 下所有子文件夹的权限,而且记录到 C:\Xcacls.log。该命令不触及文件,并且不遍历目录。
xcacls.vbs c:\test\readme.txt /o "machinea\group1"
该命令将自述文件的所有者更改为组 MachineA\Group1。
xcacls.vbs c:\test\badcode.exe /r "machinea\group1" /r "domain\testuser1"
该命令撤消 MachineA\Group1 和 Domain\TestUser1 的 C:\Test\Badcode.exe 权限。
xcacls.vbs c:\test\subdir1 /i enable /q
该命令将打开文件夹 C:\Test\Subdir1 上的继承。该命令将取消任何屏幕输出。
xcacls.vbs \\servera\sharez\testpage.htm /p "domain\group2":14
此命令通过使用 Windows Management Instrumentation (WMI) 远程连接到 \\ServerA\ShareZ。然后获取用于该共享的本地路径,在该路径下,它更改 Testpage.htm 上的权限。它原封保留 Domain\Group2 的现有权限,但是添加权限 1(读取数据)和权限 4(读取扩展属性)。该命令放弃此文件上的其他权限,原因是未使用 /e 开关。
xcacls.vbs d:\default.htm /g "domain\group2":f /server servera /user servera\admin /pass password /e
该命令使用 WMI 作为 ServerA\Admin 远程连接到 ServerA,然后将 Default.htm 上的完全权限授予 Domain\Group2。Domain\Group2 的现有权限丢失,但保留文件上的其他权限。
http://support.microsoft.com/kb/825751
Examples
The following Xcacls.vbs commands provide some examples of Xcacls.vbs usage:
xcacls.vbs c:\test\ /g domain\testuser1:f /f /t /e
This command edits existing permissions. It grants Domain\TestUser1 full control over all files under C:\Test, traverses subfolders under C:\Test, and then changes all found files. This command does not touch directories.
xcacls.vbs c:\test\ /g domain\testuser1:f /s /l "c:\xcacls.log"
This command replaces existing permissions. It grants Domain\TestUser1 full control over all subfolders under C:\Test and logs to C:\Xcacls.log. This command does not touch files and does not traverse directories.
xcacls.vbs c:\test\readme.txt /o "machinea\group1"
This command changes the owner of the readme file to group MachineA\Group1.
xcacls.vbs c:\test\badcode.exe /r "machinea\group1" /r "domain\testuser1"
This command revokes the permissions of MachineA\Group1 and Domain\TestUser1 on C:\Test\Badcode.exe.
xcacls.vbs c:\test\subdir1 /i enable /q
This command enables inheritance on folder C:\Test\Subdir1. This command suppresses any screen output.
xcacls.vbs \\servera\sharez\testpage.htm /p "domain\group2":14
This command remotely connects to \\ServerA\ShareZ using Windows Management Instrumentation (WMI). Then it obtains the local path for the share, under which it changes the permissions on Testpage.htm. It preserves the existing permissions of Domain\Group2 but adds permissions 1 (read data) and 4 (read extended attributes). This command drops other permissions on this file because the /e switch is not used.
xcacls.vbs d:\default.htm /g "domain\group2":f /server servera /user servera\admin /pass password /e
This command remotely connects to ServerA as ServerA\Admin using WMI, then grants full permissions to Domain\Group2 on Default.htm. The existing permissions of Domain\Group2 are lost, but other permissions on the file are retained.