steps to reproduce
icacls X:\VMS --% /grant Dom\HVAdmin:(CI)(OI)F ---% ; write-host hello
return-parsing symbol _---%_ directs PowerShell to return interpreting input as PowerShell commands or expressions.
What benefit does this provide? 馃
I can't say I've ever needed to worry about what I'm putting after a stop-parsing symbol other than a line break.
@vexx32, the potential benefit is in overcoming the following limitations of current --% syntax (I'm not advocating for the change, just providing background information; to me, the only truly problematic limitation is the redirection case).
> out.txt - they are passed as _literal arguments_ to the target program (if the target program happens to be a shell, _it_ would interpret it).(...) - because the closing ) is interpreted as a literal part of the command line.; and another statement - because the ; is interpreted as a literal part of the command line.--% inside a _single-line_ script block - because the closing } is interpreted as a literal part of the command line.
Most helpful comment
@vexx32, the potential benefit is in overcoming the following limitations of current
--%syntax (I'm not advocating for the change, just providing background information; to me, the only truly problematic limitation is the redirection case).> out.txt- they are passed as _literal arguments_ to the target program (if the target program happens to be a shell, _it_ would interpret it).(...)- because the closing)is interpreted as a literal part of the command line.;and another statement - because the;is interpreted as a literal part of the command line.--%inside a _single-line_ script block - because the closing}is interpreted as a literal part of the command line.