开发者

Powershell pass user input to icacls

Currently I am writing a powershell script to automate some security measures and I have run into a small problem.

icacls myDirectory /inheritance:r /grant:r 'Administrators:F' $myGroup + ':F'

will fail as $myGroup gets tacked onto the icacls call and fails to properly add permissions to both groups. This is on Windows 7 and from the context of powershe开发者_运维知识库ll.


The parser sees $myGroup + ':F' as three individual arguments. You can use either:

"${myGroup}:F"

or

($myGroup + ':F')

to provide this info to the parser as one argument.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜