本文介绍了如何在 Windows 中使用命令行向用户授予目录权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 Windows 命令行向用户授予对目录的权限(读取、写入、修改)?

How can I grant permissions to a user on a directory (Read, Write, Modify) using the Windows command line?

推荐答案

从 Vista 开始,不推荐使用 cacls.这是前几条帮助热线:

As of Vista, cacls is deprecated. Here's the first couple of help lines:

C:>cacls
NOTE: Cacls is now deprecated, please use Icacls.

Displays or modifies access control lists (ACLs) of files

您应该使用 icacls 代替.这是您授予 John 对 D:est 文件夹及其所有子文件夹的完全控制权的方式:

You should use icacls instead. This is how you grant John full control over D:est folder and all its subfolders:

C:>icacls "D:	est" /grant John:(OI)(CI)F /T

根据 do MS 文档:

According do MS documentation:

  • F = 完全控制
  • CI = Container Inherit - 此标志表示从属容器将继承此 ACE.
  • OI = Object Inherit - 此标志表示从属文件将继承 ACE.
  • /T = 递归地应用于现有文件和子文件夹.(OICI 仅适用于新文件和子文件夹).信用:@AlexSpence 的评论.
  • F = Full Control
  • CI = Container Inherit - This flag indicates that subordinate containers will inherit this ACE.
  • OI = Object Inherit - This flag indicates that subordinate files will inherit the ACE.
  • /T = Apply recursively to existing files and sub-folders. (OI and CI only apply to new files and sub-folders). Credit: comment by @AlexSpence.

有关完整文档,您可以不带参数运行icacls"或查看 Microsoft 文档此处此处

For complete documentation, you may run "icacls" with no arguments or see the Microsoft documentation here and here

这篇关于如何在 Windows 中使用命令行向用户授予目录权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 13:59