I want to user powershell to exec the command and get the execute result
let's say i want to use msival2.exe to certificate the msi installation package, and the exe will give me the information DURING the certification process..
I use Invoke-Expression
and like that...
$out_put = Invoke-Expression ".\msival2.exe $msiPackageName darice.cub"
I could get the result from $out_put, ONLY AFTER the certification....
How could I get the result DURING the process of command just like I run the msival2.exe manually...
Thanks
If you want to collect the output from msival2.exe
and at the same time see the output on the screen as it appears, I would suggest using the call operator &
, and use Tee-Object
to copy the output to a variable:
& .\msival2.exe $msiPackageName darice.cub |Tee-Object -Variable out_path