Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Print some binary data using powershell function Format-Hex
- [System.Convert]::FromHexString("C0FFEE") | Format-Hex
- # Label: Byte (System.Byte) <6DDAB385>
- #
- # Offset Bytes Ascii
- # 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- # ------ ----------------------------------------------- -----
- #0000000000000000 C0 FF EE
- #
- # Print some binary data using xxd (powershell won't do this correctly)
- #
- [System.Convert]::FromHexString("C0FFEE") | xxd
- # 00000000: 3139 320a 3235 350a 3233 380a 192.255.238.
- # Write binary data to file using Set-Content
- [System.Convert]::FromHexString("C0FFEE") | Set-Content -AsByteStream ./test.bin
- # Data is stored correctly and can be read by xxd
- xxd ./test.bin
- # 00000000: c0ff ee
- # Start-Process RedirectStandardInput also doesn't work as I would expect.
- Start-Process xxd -RedirectStandardInput ./test.bin
- # 00000000: efbf bdef bfbd 0a .......
Advertisement
Add Comment
Please, Sign In to add comment