本帖最后由 flashercs 于 2022-5-2 17:51 编辑
- <#*,:&cls
- @echo off
- cd /d "%~dp0"
- powershell -C "Set-Location -LiteralPath ([Environment]::CurrentDirectory);. ([ScriptBlock]::Create((Get-Content -LiteralPath \"%~f0\" -ReadCount 0 | Out-String)))"
- pause
- exit /b
- #>
- # NOTE:merge ACLs
- $srcdir = "\\server1\abc"
- $dstdir = "\\server2\abc"
- $srcacl = Get-Acl -LiteralPath $srcdir
- $dstacl = Get-Acl -LiteralPath $dstdir
- foreach ($rule in $srcacl.Access) {
- $dstacl.AddAccessRule($rule)
- }
- Set-Acl -LiteralPath $dstdir -AclObject $dstacl
- robocopy $srcdir $dstdir /R:3 /W:3 /MON:1 /MOT:1 /E
复制代码 MergeACLs.bat |