参考:https://learn.microsoft.com/zh-c ... le_System_Boolean__
修改第7行的值,我测试没有问题。- <# :
- @echo off
- REM 右键以管理员身份运行
- REM 需要修改权限的文件夹名称,修改之前确保该文件夹所有者为Administrators组成员
- set "folder=C:\Documents and Settings"
- REM 允许访问=Allow 禁止访问=Deny
- set "accessType=Allow"
- PowerShell ". ([ScriptBlock]::Create((gc -Literal '%~f0') -join \"`r`n\")) '%folder%' '%accessType%'"
- pause & exit
- #>
-
- param([string]$folder, [Security.AccessControl.AccessControlType]$accessType);
-
- $acl = Get-ACL $folder;
- $rule = New-Object System.Security.AccessControl.FileSystemAccessRule('Everyone', 'ReadData', $accessType);
- $acl.ModifyAccessRule('Reset', $rule, [ref]$null);
- $acl | Set-ACL $folder;
复制代码
|