如何使用 Setacl 替换权限

如何使用 Setacl 替换权限

我目前有:(SET _KEY=C:\Windows\SystemApps)%~d0\Batch\SetACL.exe -on "%_KEY%" -ot file -actn ace -ace "n:%username%;p:full %~d0\Batch\SetACL.exe -on "%_KEY%" -ot file -actn ace -actn -clr "n:SYSTEM;p:full %~d0\Batch\SetACL.exe -on "%_KEY%" -ot file -actn ace -ace "n:SYSTEM;p:full

它对此文件不执行任何操作:C:\Windows\SystemApps\Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy\core\js\appLaunchers\WindowsCoreLocalAccountCreator.js

[当前权限][1] [1]: https://i.stack.imgur.com/A6rhw.jpg

我需要更改权限才能删除该文件。我在 Windows 10 中运行。我的用户具有管理员权限。

答案1

我找到了问题的答案。这允许我删除该文件:

Set "Key=C:\Windows\SystemApps\Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy\core\js\appLaunchers\WindowsCoreLocalAccountCreator.js"
%~d0\Batch\setacl -on "%Key%" -ot file -actn setowner -ownr "n:%username%"
%~d0\Batch\SetACL -on "%Key%" -ot file -actn trustee -trst n1:System;ta:remtrst;w:dacl
%~d0\Batch\SetACL -on "%Key%" -ot file -actn trustee -trst n1:"ALL APPLICATION PACKAGES";ta:remtrst;w:dacl
%~d0\Batch\SetACL -on "%Key%" -ot file -actn trustee -trst n1:"ALL RESTRICTED APPLICATION PACKAGES";ta:remtrst;w:dacl
%~d0\Batch\SetACL -on "%Key%" -ot file -actn trustee -trst n1:Administrators;ta:remtrst;w:dacl
%~d0\Batch\SetACL -on "%Key%" -ot file -actn trustee -trst n1:Users;ta:remtrst;w:dacl
%~d0\Batch\SetACL -on "%KEY%" -ot file -actn ace -ace "n:%username%;p:full"

相关内容