How can I view the binary contents of a file natively in Windows 7? (Is it possible.)
I have a file, a little bigger than 500MB, that is causing some problems.
I believe the issue is in the end of line (EOL) convention used. I would like to look at the file in its uninterpreted raw form (1) to confirm the EOL convention of the file.
How can I view the "binary" of a file using something built in to Windows 7? I would prefer to avoid having to download anything additional.
(1) My coworker and I opened the file in text editors, and they show the lines as one would expect. But both text editors will open files with different EOL conventions and interpret them automagically. (TextEdit and Emacs 24.2. For Emacs I had created a second file with just the first 4K bytes using head -c4096
on a linux box and opened that from my windows box.
I attempted to use hexl-mode in Emacs, but when I went to hexl-mode and back to text-mode, the contents of the buffer had changed, adding a visible ^M to the end of each line, so I'm not trusting that at the moment.
I believe the issue may be in the end of line character(s) used. The editors my coworker and I tried (1) just automagically recognized the end of line convention and showed us lines. And based on other evidence I believe the EOL convention is carriage return only. (2) return only.
To know what is actually in the file, I would like to look at the binary contents of the file, or at least a couple thousand bytes of the file, preferablely in Hex, though I could work with decimal or octal. Just ones an zeros would be pretty rough to look at.
UPDATE
Except the one suggesting DEBUG
, all the answers below work to some extent or another. I have up-voted each of those as helpful. My question was ill-formed. In testing each suggested solution I found I really wanted side by side hex and text contents viewing, and that I wanted it to be something where when I had my cursor over something, either a byte value or the text character, the matching thing on the other side would be highlighted.
I actually solved my problem when Emacs hexl-mode started working "correctly". So I ended up not using any of these answers, only testing them.(Really should investigate the weird Emacs behavior and file a bug-report.)
Solution 1:
You need a "hex editor". I've used "Hex Editor Neo" for years and it's very good. It's available in free and paid versions. (And I'm sure there are other similar tools available.)
Solution 2:
If you have powershell version 5.0 or later, you can use the powershell
built-in function Format-Hex
PS:21 C:\Temp >Format-Hex application.exe
0 1 2 3 4 5 6 7 8 9 A B C D E F
00000000 42 4D 5E 00 00 00 00 00 00 00 36 00 00 00 28 00 BM^.......6...(.
00000010 00 00 0A 00 00 00 01 00 00 00 01 00 20 00 00 00 ............ ...
00000020 00 00 00 00 00 00 C4 0E 00 00 C4 0E 00 00 00 00 ......Ä...Ä.....
00000030 00 00 00 00 00 00 B7 59 71 FF B7 59 71 FF B7 59 ......•Yq.•Yq.•Y
00000040 71 FF B7 59 71 FF B7 59 71 FF B7 59 71 FF B7 59 q.•Yq.•Yq.•Yq.•Y
00000050 71 FF B7 59 71 FF B7 59 71 FF B7 59 71 FF q.•Yq.•Yq.•Yq.
Solution 3:
Built in, quick and dirty: start powershell
, execute:
gc -encoding byte -TotalCount 100 "your_file_path" |% {write-host ("{0:x}" -f $_) -noNewline " "}; write-host
TotalCount is count of bytes you want to read from file.
Google 'powershell hexdump' to get much more polished/workable versions.
If you have Windows Resource Kit Tools (not exactly built in, but close) you may also use a cmd line utility called list.exe
. It's a small editor with hex mode. Designed specifically to work with big files:
List Text File Tool (List) is a command-line tool that displays and searches one or more text files. Unlike other text display tools, List does not read the whole file into memory when you open it. It allows a user to edit a text file in a hexadecimal format.
List is useful for displaying text or log files remotely, and for use on servers where administrators are concerned with degradation of system performance.
Solution 4:
This also works on everything after XP:
certutil -encodehex MyProgram.exe MyProgram.txt
XP requires the Windows Server 2003 Administration Tools Pack from here :
https://www.microsoft.com/en-us/download/details.aspx?id=16770