powershell遍历文件夹设置权限,解决文件无法删除的问题。
function set-rights ($path) { $p = Get-Item $path; if ($p.Attributes -eq 'Directory') { foreach ($child in Get-ChildItem $p.FullName) { set-X($child.FullName); } } icacls $p.FullName /grant 'everyone:f'; } $path="E:\abc"; set-rights($t);