简体   繁体   English

在Windows 10上,授予用户创建,编辑和删除文件夹C:\\ VMs中的文件的权限,但禁止删除文件夹本身

[英]On Windows 10, grant a user rights to create, edit and delete files in the folder C:\VMs, but prevent deletion of the folder itself

I need users to be able to access and modify contents in a folder C:\\VMs. 我需要用户能够访问和修改文件夹C:\\ VMs中的内容。 I'm using https://ss64.com/nt/icacls.html as a guide. 我正在使用https://ss64.com/nt/icacls.html作为指南。 At the bottom of the page there is a list of commands to do exactly what I need, but the first command is not working. 在页面底部,有一些命令列表可以完全满足我的需要,但是第一个命令不起作用。

In Powershell I am typing 在Powershell中,我输入

icacls.exe "C:\VMware" /inheritance:r /grant:r testuser:(OI) (CI) (F)

and am getting the error 并得到错误

The term 'OI' is not recognized as the name of a cmdlet...

I've tried various iterations using different spacing and quotations and the likes but have not had any luck. 我已经尝试过使用不同的间距和引号等进行各种迭代,但是没有任何运气。

The problem is that brackets have a special meaning in Powershell . 问题在于括号在Powershell中具有特殊含义 They must be quoted if they are to be passed as-is to an external program. 如果要将它们原样传递给外部程序,则必须用引号引起来。 The article you link to assumes that you are using the legacy command shell, which does not give brackets a special meaning in this context. 链接到的文章假定您正在使用旧式命令外壳,在这种情况下,它在方括号中没有特殊含义。

One way to make this work is to use the backtick as an escape character: 进行此工作的一种方法是将反引号用作转义字符:

icacls test /grant Everyone:`(OI`)`(CI`)`(RX`)

Since you are running Windows 10, you can use the stop-parsing symbol instead: 由于您正在运行Windows 10,因此可以改为使用停止解析符号

icacls test --% /grant Everyone:(OI)(CI)(RX)

The stop-parsing symbol requires Powershell 3 or later, so it will not work out-of-the-box on a Windows 7 machine, but on Windows 10 you'll be fine. 停止解析符号需要Powershell 3或更高版本,因此它在Windows 7计算机上不能即用工作,但是在Windows 10上就可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从文件夹中删除文件[Windows] - Delete files from folder [Windows] 如何在Windows 10 UWP上的工作文件夹中创建文件 - How to create files in working folder on Windows 10 UWP 在Windows环境中编辑文件夹白名单上的文件 - Edit files on folder whitelist in Windows environment 如何从安装在 Windows 10 上的 Wampserver 3 编辑/保存远程共享文件夹中的文件? - How to edit / save files on remote shared folder from Wampserver 3 installed on Windows 10? Puppet 无法在 C:\\windows\\system32 文件夹中创建文件 - Puppet is not able to create files in C:\windows\system32 folder 在 Windows CMD 上递归删除文件或文件夹 - Delete files or folder recursively on Windows CMD Windows Cmd:从文件夹中删除文件 - Windows Cmd : Delete files from a folder 如何使用 python 真正删除文件夹中的所有文件和 Windows 上的文件夹? - How to really delete all files in a folder and the folder on Windows using python? 删除Windows帐户时,如何删除c:\\ users下的用户帐户文件夹? - How can the folder of a user account under c:\users be delete when delete windows account? Windows SYSTEM用户授予对其自身的读取访问权限-无法打开文件夹 - Windows SYSTEM user granting READ access to itself - cannot open folder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM