Get the App
SLTechnology News&Howtos  ›  Servers  › 

Batch modification and assignment of user and folder permissions by Icacls (2)

Shulou Source: shulou.com Published: 2022-06-03 05:38:38 09月21日 Update

In the previous article we talked about simple add, modify, delete, batch folder permissions granted to a single user.

Below we will use scripts to batch process our folder permissions

Create a new 1.bat script on disk D to store the code

The script is roughly as follows: @echo offfer/f "skip=1 eol=; token=1-6 delims=," %%a in (d:\1234\1234.cvs) do icacls %%a %%b %%c%%d %e %%f /Tpause Some basic explanations of script: "skip=1 eol=; token=1-6 delims=,"skip=1 Skip the first line: the first line sets Chinese slogan folder user permission registration eol=; The behavior at the beginning of the semicolon comment line token=1-6 Assign variables %%a, %%b, %%c,%%d,%%e,%%fdelims=, comma separator %%a Column A of the corresponding table %%b Column B of the corresponding table %%c Column C of the corresponding table mainly contains %%c%%d directly without spaces. %% d Column D of the corresponding table %%e Column E of the corresponding table %%f Column F of the corresponding table

Add a file of 1234.cvs to d:\1234 and write the following data. Later, you can adjust it according to the needs of the child.

Here's an example: Grant 999 read permissions to folder 12

Delete 999 permissions for folder 13

Tags: Files tables folders permissions scripts lines users individuals code examples semicolons delimiters variables fields beginnings data banners comments spaces behaviors Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft MariaDB Huawei OPPO Reno Shulou Tech Info