中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-10 12:06
47,811 topics / 349,897 posts / today 0 new / 48,255 members
DOS批处理 & 脚本技术(批处理室) » Tool for setting advanced NTFS permissions: XCACLS.vbs
Printable Version  8,119 / 44
Floor1 electronixtar Posted 2006-12-22 14:59
铂金会员 Posts 2,672 Credits 7,493
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.

Attachments
XCACLS.rar (22.21 KiB)
Floor2 vkill Posted 2006-12-22 23:35
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
I still don't understand what the maximum function of this is compared to cacls?
Floor3 ylylpp Posted 2007-01-16 04:06
新手上路 Posts 5 Credits 9
Not knowing code and English, but wanting to learn P processing, it's difficult, dizzy
Floor4 ccuu668 Posted 2007-01-21 10:21
初级用户 Posts 29 Credits 57
Floor5 zhenyun168 Posted 2007-01-27 14:18
初级用户 Posts 13 Credits 24
Floor6 lawrence Posted 2007-03-21 04:52
新手上路 Posts 5 Credits 10
Why is this so complicated? Can you explain it more simply? I'm completely confused. It seems I still need to work hard to master this knowledge. :(
Floor7 baomaboy Posted 2007-03-21 09:29
银牌会员 Posts 554 Credits 1,513
Floor8 sdo116688 Posted 2007-03-24 10:13
新手上路 Posts 1 Credits 2
Why can't I download directly? It's really frustrating. I still need points!
Floor9 dachairen Posted 2007-05-05 12:00
新手上路 Posts 4 Credits 7
Floor10 ollo Posted 2007-05-17 19:17
新手上路 Posts 1 Credits 2
Floor11 huanglsh Posted 2007-06-11 20:21
新手上路 Posts 6 Credits 15
Can I just put it out directly?? I want to learn batch processing
But now I have no points. I'll give it to you later~~~~ ~!~
Floor12 tiancaizfy Posted 2007-06-17 12:10
新手上路 Posts 7 Credits 14
Is this benefit that there's no need for confirmation?
Floor13 dhrsyc Posted 2007-07-08 10:01
新手上路 Posts 1 Credits 2
Looking for issues with batch processing to set permissions, thank you to the楼主.
Floor14 shifeixuan Posted 2007-07-27 07:24
新手上路 Posts 6 Credits 11
Develop good habits, give a thumbs-up after downloading
Floor15 wmmyjb Posted 2007-07-27 09:41
新手上路 Posts 3 Credits 5
The following are some examples of Xcacls.vbs commands showing how to use Xcacls.vbs:

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 gets the local path for this share, and under this path, it changes the permissions on Testpage.htm. It preserves the existing permissions of Domain\Group2 as is, but adds permission 1 (read data) and permission 4 (read extended attributes). This command discards 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 uses WMI to remotely connect to ServerA as ServerA\Admin, and then grants full permissions on Default.htm to Domain\Group2. The existing permissions of Domain\Group2 are lost, but other permissions on the file are retained.
1 2 3  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023