Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.)

share|improve this question
    
Likely there's some sort of tool under Cygwin, but that would require installing Cygwin. Or if you have, eg, Java installed on your box, it would be a fairly simple task to write a hex dump program in Java. –  Daniel R Hicks Aug 31 '12 at 3:32

6 Answers 6

up vote 1 down vote accepted

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.)

share|improve this answer
1  
I had asked how, without anything besides Windows 7 because I do not like adding additional programs because 1) Many install in a way that the rights I have do not allow. 2) Some look to be dodgy. That said Hex Editor Neo looks to be a good recommendation. +1 –  Shannon Severance Aug 31 '12 at 1:22
1  
zblist.com is a standalone program that doesn't need to be installed or need any special rights and has an Alt-H or hex mode –  sgmoore Aug 31 '12 at 8:33
    
Met all my requirements including stated, misstated, unstated. Hex Editor Neo was fast too, and has been added to my tool bag. –  Shannon Severance Sep 20 '12 at 0:19

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.

share|improve this answer
    
So far, this solution is the closest that I was asking for. –  Shannon Severance Aug 31 '12 at 1:10
    
+1 Closest to the intent of original question. –  Shannon Severance Sep 20 '12 at 0:19
    
Nice, simple, already installed. I changed the format to write-host ("{0:X2}" to force 0x0A to appear as "0A" not "A", the 2 for 2 digit the upper case because that's how I like it –  Adam Straughan Nov 5 '13 at 14:01

Since Windows 7 comes with the dotnet framework 3.5 built in, you will have the C# compiler built in, so you can grab, for example, the listing from http://illegalargumentexception.blogspot.co.uk/2008/04/c-file-hex-dump-application.html and then compile using

  \windows\Microsoft.NET\Framework\v3.5\csc printhex.cs 

and you should end up with a printhex.exe which should display both hex and ascii characters.

share|improve this answer
    
+1 Does what I asked. –  Shannon Severance Sep 20 '12 at 0:20
    
Simple, and no need for gigantic download. –  Little Lulu Sep 17 at 18:13

It is not ideal, but if you really don't want to download anything, then you could try using fc /b (ie file compare in binary mode) to compare this file with another completely different file, and it will show you the hex values of each byte that is different. You will may get some values that happen to be the same in the two files and so may be skipped from the output, but you can tell if that happens by checking for missing values in the offset column.

share|improve this answer
    
Not ideal, but I was able to do so by creating a file of 0x00 bytes and then compare against that. Being a text file that I was looking at, and that I was interested in 0a and 0d mostly a file of nulls as comparison worked. But it doesn't provide both the character view and hex view side by side made finding where I wanted to look harder. (As debug does in Scott's answer and as Emacs's hexl-mode does. I had not asked for side by side view, but it's pretty crucial for how I actually use hex dumps.) –  Shannon Severance Aug 31 '12 at 0:47

Copy the file to a name with a .COM extension, where the base name is no longer than eight characters.  Run

DEBUG your_filename

It will give a '-' prompt.  Type

DEnter

repeatedly to display the file 128 bytes at a time.  Type

D address Enter

to display 128 bytes starting at address, which must be typed in hex, where the beginning of the file is address 100.  Type

D address1 address2 Enter

to display from address1 to address2.  Type

D address Lnum Enter

to display num bytes (length) starting at addressnum is also entered in hex.  Use Q to quit.

For example,

C:\Users\scott\Documents> debug thispost.com
-d
0BE4:0100  43 6F 70 79 20 74 68 65-20 66 69 6C 65 20 74 6F   Copy the file to
0BE4:0110  20 61 20 6E 61 6D 65 20-77 69 74 68 20 61 20 2E    a name with a .
0BE4:0120  43 4F 4D 20 65 78 74 65-6E 73 69 6F 6E 2C 20 77   COM extension, w
0BE4:0130  68 65 72 65 20 74 68 65-20 62 61 73 65 20 6E 61   here the base na
0BE4:0140  6D 65 20 69 73 20 6E 6F-20 6C 6F 6E 67 65 72 20   me is no longer
0BE4:0150  74 68 61 6E 20 65 69 67-68 74 20 63 68 61 72 61   than eight chara
0BE4:0160  63 74 65 72 73 2E 0D 0A-52 75 6E 20 44 45 42 55   cters...Run DEBU
0BE4:0170  47 20 2A 79 6F 75 72 5F-66 69 6C 65 6E 61 6D 65   G *your_filename
-d
0BE4:0180  2A 0D 0A 49 74 20 77 69-6C 6C 20 67 69 76 65 20   *..It will give
0BE4:0190  61 20 27 2D 27 20 70 72-6F 6D 70 74 2E 0D 0A 54   a '-' prompt...T
0BE4:01A0  79 70 65 20 44 20 45 6E-74 65 72 20 72 65 70 65   ype D Enter repe
0BE4:01B0  61 74 65 64 6C 79 20 74-6F 20 2A 2A 64 2A 2A 69   atedly to **d**i
0BE4:01C0  73 70 6C 61 79 20 74 68-65 20 66 69 6C 65 20 31   splay the file 1
0BE4:01D0  32 38 20 62 79 74 65 73-20 61 74 20 61 20 74 69   28 bytes at a ti
0BE4:01E0  6D 65 2E 0D 0A 54 79 70-65 20 44 20 5F 61 64 64   me...Type D _add
0BE4:01F0  72 65 73 73 5F 20 74 6F-20 64 69 73 70 6C 61 79   ress_ to display
-d 200 L16
0BE4:0200  20 31 32 38 20 62 79 74-65 73 20 73 74 61 72 74    128 bytes start
0BE4:0210  69 6E 67 20 61 74                                 ing at
-
share|improve this answer
1  
Unfortunately that won't work if the file is larger than about 64KB, the max for a .COM. (It has to fit in the segment starting at offset 100h.) –  Ken Aug 31 '12 at 0:18
    
C:\>attrib debug.exe /s. Results: File not found - debug.exe. Was unable to find official, debug is no longer supported statement, but from what I saw on the web it looks like debug support has been dropped awhile ago. I found DebugDiag from Microsoft. (Extra download.) Debugging? Maybe it supports looking at files in HEX? Delivered as an .MSI file. Needs an admin password to install. I'm not one. –  Shannon Severance Aug 31 '12 at 0:23
    
@Ken I had already used head -c4096 bigFileName > smallFileName on linux to get the first 4 KB of the files. Lines are small enough that four KB has plenty of lines for my purposes –  Shannon Severance Aug 31 '12 at 0:34
    
So why not use hexdump -C while on Linux? –  Ken Aug 31 '12 at 0:47
1  
@Shannon debug is part of DOS, and as such, if you are using x64, it is not there. –  kinokijuf Aug 31 '12 at 5:27

HxD is a portable hex editor, which means no installation necessary, and is nothing more than a single exe file.

http://mh-nexus.de/en/hxd/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.