【发布时间】:2010-12-19 05:26:29
【问题描述】:
是否可以让 Powershell 将 exe 的标准输出读入 byte[] 而不是通常的文本处理的行数组?
我能做的最好的就是:
cmd /c foo.exe > foo.tmp
$b = [io.file]::readallbytes('foo.tmp')
del foo.tmp
很糟糕,更不用说它不可流式传输了。有更好的方法吗?
【问题讨论】:
标签: powershell
是否可以让 Powershell 将 exe 的标准输出读入 byte[] 而不是通常的文本处理的行数组?
我能做的最好的就是:
cmd /c foo.exe > foo.tmp
$b = [io.file]::readallbytes('foo.tmp')
del foo.tmp
很糟糕,更不用说它不可流式传输了。有更好的方法吗?
【问题讨论】:
标签: powershell
从 PowerShell 团队获得了一些信息。简短的回答是,不幸的是,这并不容易。 :-(
中等长度的答案是:http://poshcode.org/2175。
【讨论】: