i am trying to pass the following string to an invoke-command: " icacls C:\ /grant:r BUILTIN\Users:(OI)(CI)(RX)"
I get this error: The term 'OI' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again
How can i escape the parentheses. I tried it with ` and \
by AlexBrassington at 2013-02-18 00:00:17
I think that passing the values in using single quotes will tell PowerShell not to modify the string contents.
The double quotation mark option is generally the same as the single however when a string is in double quotation marks PowerShell will try to process any variables you've got in there.
#Demonstration of single vs. double quotes $var = "Cake"
#Double quotes will make PowerShell process the contents of the string Write-Host "I love $var"
#Single quotes will fail to express your love of cake properly Write-Host 'I love $var'
by selko at 2013-02-18 02:41:46
' C:\ /grant:r BUILTIN\Users:(OI)(CI)(RX)'
it still shows up the same error...
by selko at 2013-02-18 03:01:15
This works: ' C:\ /grant:r BUILTIN\Users:`(OI`)`(CI`)`(RX`)'