Files
tldr/pages.zh/windows/set-acl.md

13 lines
511 B
Markdown

# Set-Acl
> 更改指定项的安全描述符,例如文件或注册表项。
> 注意:此命令只能通过 PowerShell 使用。
> 更多信息:<https://learn.microsoft.com/powershell/module/microsoft.powershell.security/set-acl>。
- 从一个文件复制安全描述符到另一个文件:
`$OriginAcl = Get-Acl -Path {{path\to\file}}; Set-Acl -Path {{path\to\file}} -AclObject $OriginAcl`
- 使用管道运算符传递描述符:
`Get-Acl -Path {{path\to\file}} | Set-Acl -Path {{path\to\file}}`