windows 创建文件夹/文件并设置权限

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4680019/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 15:58:17  来源:igfitidea点击:

Create folder/file and set permissions

windowscommand-linecommand-prompt

提问by Ana88

How to in XP from command line create folder/file and after that allow everything to everyone permissions ? I tried from properties, I deselect readonly but when I open properties again for that folder/file it is always READONLY.

如何在 XP 中从命令行创建文件夹/文件,然后允许所有人拥有所有权限?我从属性中尝试,我取消选择只读,但是当我再次打开该文件夹/文件的属性时,它始终是只读的。

回答by Nicolas

You have to use "CACLS".
Use CACLS /help to have the documentation.
Here 2 exemples:
To give the full right to the user "user1" to the directory

您必须使用“CACLS”。
使用 CACLS /help 获取文档。
这里有 2 个例子:
赋予用户“user1”对目录的完整权限

CACLS c:\directory /E /T /C /G "user1":F

To give the full right to the user "user1" to the content of the directory

授予用户“user1”对目录内容的完全权限

CACLS c:\directory\*.* /E /T /C /G "user1":F 

回答by SvenS

CACLS /help:

CACLS /帮助:

NOTE: Cacls is now deprecated, please use Icacls.

To give the full right to the user "user1" to the directory (Nicolas' example converted):

授予用户“user1”对目录的全部权限(Nicolas 的示例已转换):

Icacls c:\directory /T /C /grant "user1":F