Betrifft anscheinend /remove
keine geerbten ACLs:
C:\Windows\System32> pushd d:\bat\files2 d:\bat\files2> for /d %G in (*) do @icacls %G /T | findstr /I "folder \\Users" folder BUILTIN\Administrators:(F) BUILTIN\Users:(I)(RX) BUILTIN\Users:(I)(OI)(CI)(IO)(GR,GE) folder\xxx.csv BUILTIN\Administrators:(F) BUILTIN\Users:(I)(RX) d:\bat\files2> for /d %G in (*) do @icacls %G /remove Users /T processed file: folder processed file: folder\xxx.csv Successfully processed 2 files; Failed processing 0 files d:\bat\files2> for /d %G in (*) do @icacls %G /T | findstr /I "folder \\Users" folder BUILTIN\Administrators:(F) BUILTIN\Users:(I)(RX) BUILTIN\Users:(I)(OI)(CI)(IO)(GR,GE) folder\xxx.csv BUILTIN\Administrators:(F) BUILTIN\Users:(I)(RX)
Man muss die Vererbung deaktivieren und zuerst die ACEs kopieren :
d:\bat\files2> for /d %G in (*) do @(icacls %G /inheritance:d /T&&icacls %G /remove Users /T) processed file: folder processed file: folder\xxx.csv Successfully processed 2 files; Failed processing 0 files processed file: folder processed file: folder\xxx.csv Successfully processed 2 files; Failed processing 0 files d:\bat\files2> for /d %G in (*) do @icacls %G /T | findstr /I "folder \\Users" folder BUILTIN\Administrators:(F) folder\xxx.csv BUILTIN\Administrators:(F)
Beachten Sie die Verwendung des &&
Bedieners in dem folgenden Einzeiler
for /d %G in (*) do @(icacls %G /inheritance:d /T&&icacls %G /remove Users /T)
anstatt
for /d %G in (*) do @icacls %G /inheritance:d /T for /d %G in (*) do @icacls %G /remove Users /T
Beispiel auf folgende Dateistruktur angewendet:
d:\bat\files2> tree . /f D:\BAT\FILES2 │ SampleInput.eml │ └───folder xxx.csv