Posted Dec 9, 2011 12:25 UTC (Fri) by nix (subscriber, #2304)
[Link]
quotemstr is trying to show you faults in the Windows command-line parsing system by using whoami as a tool to indicate the contents of the first argument.
You are treating it as if he wants to run 'whoami' but doesn't know how.
When a finger points at the moon...
Evolution of shells in Linux (developerWorks)
Posted Dec 10, 2011 3:00 UTC (Sat) by Cyberax (✭ supporter ✭, #52523)
[Link]
I understand that 'whoami' is used as an example.
I finally understood what author wants and gave an answer: "@($var -split ' ')". It does the braindead thing that was requested.
Why braindead? Because good PowerShell scripts would just use an _array_ and 'splat' it when required, instead of constructing shell arguments as raw strings.
And no, this hack with splitting string into arguments is definitely not required to work with legacy code.