nwg*_*gat 6 windows batch-file icacls
我有这个,很确定它有点苛刻但可以完成工作,在驱动器上运行时赋予我对驱动器上文件和文件夹的所有权利,现在我需要帮助将其放入子目录,所以我不需要将 bat 脚本复制到每个文件夹中并必须运行它。
takeown /f *
icacls * /grant Administrator:F
icacls * /grant Administrators:F
icacls * /grant SYSTEM:F
icacls * /grant "Authenticated Users":F
Run Code Online (Sandbox Code Playgroud)
我如何让它递归遍历驱动器?
简答: 添加/t到 (i)cacls
长答案:
这是我希望任何用户都可以访问该文件时使用的脚本。它包括对每个标志的作用的评论。只需将其放在文件%AppData%夹中某处的批处理文件中即可。
REM --v2 -----------------------------------------------------------
takeown /r /d y /f %1
icacls %1 /t /grant Everyone:F
REM takeown /r /d y /f will set the owner to the Administrators group recursively.
REM /t makes it recursive
REM /grant Sets the permision to the following user, replaces existing permissions for the specified uesr.
REM :f Grants full controll permission.
REM ----------------------------------------------------------------
REM --v1 -----------------------------------------------------------
REM cacls %1 /t /e /g Everyone:f
REM /t makes it recursive
REM /e Edits the ACL instead of replaceing it
REM /g Grants permissions to the following users
REM :f Grants full controll permission.
REM ----------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)
然后在%AppData%\Microsoft\Windows\SendTo创建批处理脚本的快捷方式。
编辑该快捷方式的属性并转到Advanced...并选中该框Run as Administrator.

现在,您right click menu -> Send To将拥有一个名为“Fix Permissions任何文件或文件夹”的项目,您Send To将拥有“Everyone”组授予的Full Access权限。如果您在文件夹上执行它,它将递归遍历它并将权限应用于文件夹中的所有子项。
我将批处理文件保存在文件%AppData%夹中,因为我在一个域中,这使它成为我的漫游配置文件的一部分,因此它可以在我连接的任何计算机上打开并准备使用。
| 归档时间: |
|
| 查看次数: |
48403 次 |
| 最近记录: |