I have seen a few posts on this new –% parameter. Does anyone have details on it? I checked help but it's not in there yet.
by Makovec at 2012-10-16 16:06:36
It's related to parsing command lines with "strange" parameters/values like $%-. When PowerShell v3 see –% it change it's parsing mode.
[quote]Easier Reuse of Command Lines From Cmd.exe
The web is full of command lines written for Cmd.exe. These commands lines work often enough in PowerShell, but when they include certain characters, e.g. a semicolon (;) a dollar sign ($), or curly braces, you have to make some changes, probably adding some quotes. This seemed to be the source of many minor headaches.
To help address this scenario, we added a new way to â€œescapeâ€ the parsing of command lines. If you use a magic parameter –%, we stop our normal parsing of your command line and switch to something much simpler. We donâ€™t match quotes. We donâ€™t stop at semicolon. We donâ€™t expand PowerShell variables. We do expand environment variables if you use Cmd.exe syntax (e.g. %TEMP%). Other than that, the arguments up to the end of the line (or pipe, if you are piping) are passed as is. Here is an example:
It's documented in the online version of about_Parsing help topic (http://technet.microsoft.com/en-us/libr ... 47892.aspx). Search for "STOP PARSING: –%" section. Unfortunately, when you use Update-Help you don't get that updated version.