dongren4758 2019-06-03 12:34 采纳率: 0%
浏览 127

与命令提示符相比,PowerShell如何处理重定向? [重复]

I am running a Go program that generates a file in gif format. When using Bash or Command Prompt, the file is generated successfully. However, when using PowerShell or PowerShell-Core, I receive an error: "The image ‘file:///C:\Users\blah\blah\blah’ cannot be displayed because it contains errors".

How can I generate this file correctly using PowerShell?

I have attempted to run the exact same commands that worked on Bash and Command Prompt. I have also tried using PowerShell cmdlets like Out-File and Tee-Object.

go build main.go
.\main.exe > out.gif
firefox out.gif

Performing the above actions in Bash or Command Prompt generate the file and the expected gif. Performing the action in PowerShell yields the error message described above (image cannot be displayed because it contains errors).

I have also tried:

.\main.exe | Out-File out.gif
and
.\main.exe | Tee-Object out.gif

Both generate the broken file.

</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 关于#qt#的问题:Qt代码的移植问题
    • ¥50 求图像处理的matlab方案
    • ¥50 winform中使用edge的Kiosk模式
    • ¥15 关于#python#的问题:功能监听网页
    • ¥15 怎么让wx群机器人发送音乐
    • ¥15 fesafe材料库问题
    • ¥35 beats蓝牙耳机怎么查看日志
    • ¥15 Fluent齿轮搅油
    • ¥15 八爪鱼爬数据为什么自己停了
    • ¥15 交替优化波束形成和ris反射角使保密速率最大化