I want to evaluate the content from StdIn in Powershell, like this:
echo "echo 12;" | powershell -noprofile -noninteractive -command "$input | iex"
Output: echo 12;
Unfortunately, $input
is not a String, but a System.Management.Automation.Internal.ObjectReader
, which make iex
not working as expected... since this one is working correctly:
powershell -noprofile -noninteractive -command "$command = \"echo 12;\"; $command | iex"
Output: 12