PowerShell and (not) parsing command lines
A short reminder note for myself.
To tell PowerShell to not parse the remainder of a line, use --%
. This is invaluable when calling out to external commands and you don’t want to escape every special character with a backtick (`).
So instead of this:
icacls X:\VMS /grant Dom\HVAdmin:`(CI`)`(OI`)F
You can write this:
icacls X:\VMS –% /grant Dom\HVAdmin:(CI)(OI)F
See the Stop Parsing section in Online Help for more info.
Categories: PowerShell