@echo off
rem 设定临时变量作用域范围
setlocal
set /p username=请输入域用户名:
echo %username%
icacls "D:\a2" /grant aaa\%username%:(OI)(CI)(F) /T
net share a1=D:\a2
SetACL.exe -on "a1" -ot shr -actn trustee -trst "n1:Everyone;ta:remtrst;w:dacl,sacl" -rec cont_obj -ignoreerr
SetACL.exe -on "a1" -ot shr -actn ace -ace "n:aaa\%username%;p:full"
endlocal
rem 结束临时变量作用域范围
rem 设定临时变量作用域范围
setlocal
set /p username=请输入域用户名:
echo %username%
icacls "D:\a2" /grant aaa\%username%:(OI)(CI)(F) /T
net share a1=D:\a2
SetACL.exe -on "a1" -ot shr -actn trustee -trst "n1:Everyone;ta:remtrst;w:dacl,sacl" -rec cont_obj -ignoreerr
SetACL.exe -on "a1" -ot shr -actn ace -ace "n:aaa\%username%;p:full"
endlocal
rem 结束临时变量作用域范围
pause
SetAcl 官网:https://helgeklein.com/setacl/
下载:https://helgeklein.com/download/