[英]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.