How to pipe the output of a command to a file without powershell changing the encoding?

后端 未结 3 609
面向向阳花
面向向阳花 2021-01-20 02:50

I want to pipe the output of a command to a file:

PS C:\\Temp> create-png > binary.png

I noticed that Powershell changes the encoding

3条回答
  •  爱一瞬间的悲伤
    2021-01-20 03:28

    According to this well written blog article

    When using curl with PowerShell, never, never redirect to file with >. Always use the –o or –out switch. If you need to stream the output of curl to another utility (say gpg) then you need to sub-shell into cmd for the binary streaming or use temporary files.

提交回复
热议问题