Output all Invoke-Expression in PowerShell v2

回眸只為那壹抹淺笑 提交于 2019-12-12 03:28:19

问题


Trying to run an command-line executable from within a PowerShell script, unfortunately the current limitation is the host running only version 2.

The command runs fine, however it appears to only be partial output that is added to the variable, and just by chance the most important information is being missed. Is there anyway to capture everything into the output?

$output = Invoke-Expression ($itemCommand)
Write-Output $output

Testing on v3 and v4 works just fine, in fact was able to get away without using $output.

Anyone know if it is possible to have a portable copy of PowerShell v3 or v4 on a host running v2?

来源:https://stackoverflow.com/questions/35979395/output-all-invoke-expression-in-powershell-v2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!