HexDump plugin for Take Command / TCC / TCC/LE

beta version 0.96.9     2025-08-21

Charles Dye

Purpose:

This plugin adds one new command, HEXDUMP, which displays files or standard input to standard output as hexadecimal values. This can be useful to study what kind of data is being sent, say, to a pipe; to figure out how a file is encoded; or to snoop for strings in a binary file.

There are a lot of hexdump utilities out there. This one supports Take Command-style syntax: /A: to select files by attributes, /S to search into subdirectories, /P to page output, and so on. It also recognizes Unicode files including UTF-16 and UTF-8, and displays Unicode characters in its text field.

HEXDUMP is fairly flexible in that it can display data as bytes, words, or doublewords. Multibyte values may be either little-endian or big-endian. You can display values in hexadecimal, octal, or decimal. You can choose the number of bytes to display per line, or HEXDUMP can pick its own line length based on the console size. You can suppress the address field with /NI and the text field with /NT.

Installation:

To use this plugin, copy HexDump.dll to some known location on your hard drive. (If you are still using the 32-bit version of Take Command, take HexDump-x86.dll instead of HexDump.dll.) Load the .DLL file with a PLUGIN /L command, for example:

plugin /l c:\bin\tcmd\test\hexdump.dll

If you copy the .DLL file to a subdirectory named PlugIns within your Take Command program directory, it will be loaded automatically when TCC starts.

Plugin Features:

New Command
HEXDUMP

Syntax Note:

The syntax definitions in the following text use these conventions for clarity:

BOLD CODEindicates text which must be typed exactly as shown.
CODEindicates optional text, which may be typed as shown or omitted.
Bold italicnames a required argument; a value must be supplied.
Regular italicnames an optional argument.
ellipsis…after an argument means that more than one may be given.

Examples are shown in a gray box:

rem   This is an example:
hexdump /h /x build.txt


Some command options take an argument. These are shown with a colon between the option and its argument: /A:arg

If you like, you may substitute an equals sign for the colon: /A=arg This is handy if the arg is a filename, and you want to use tab completion to enter the filename.

Or you can omit the colon: /Aarg

New Command:

HEXDUMP — Display files or standard input to standard output as hex.

Syntax:
HEXDUMP /A:attr /B /BE /C:start /CP:n​ /D /E:end /F:n /H /HH /I /J​ /K:n /LE /M:max /ML:lines /N:flags /P /Q /S /U​ /W /X /Z:char filename…

/A:attrfilter by attributes
/B  or  /1dump bytes
/BEbig-endian
/C:startstart address
/CP:ncode page to use for non-Unicode text
/CRuse CR line ends
/CRLFuse CR/LF line ends
/D  or  /4dump doublewords (four-byte integers)
/E:endend address
/F:nnumeric base for values 16
/Hdisplay filenames
/HHdisplay filenames, sizes, and text encodings
/Iinclude a final summary line
/Jhighlight alternate lines
/K:nbytes per line
/LElittle-endian
/LFuse LF line ends
/M:maxmaximum number of bytes to display
/ML:linesmaximum number of lines to dump
/N:flagsdisable features
/Ppage output
/Q  or  /8dump quadwords (eight-byte integers)
/Ssearch into subdirectories for matching files
/UUnixy mode
/UCuppercase hexadecimal addresses and values
/W  or  /2dump words (two-byte integers)
/Xuse control pictures for ASCII control characters
/Z:charset the replacement character0xB7

Filenames may be specified on the command line, or text may be redirected or piped into HEXDUMP. Wildcards, directory aliases, and CLIP: are supported.

If you do not specify any filenames, HEXDUMP will read from standard input. If standard input is not redirected from a file or pipe, HEXDUMP will read from the keyboard; type Ctrl-Z and then Enter to finish.

If you want to pipe to HEXDUMP, remember that pipes open a new shell. You must either ensure that this plugin is loaded in the new shell, e.g. by copying its .DLL file to the PlugIns directory; or else use an in-process pipe with the |! syntax.


/F:n lets you specify the numeric base for displaying values. Legal values are:

/F:O  or  /F:8octal
/F:D  or  /F:10decimal
/F:S  or  /F:+signed decimal
/F:H  or  /F:16hexadecimal (the default)

Addresses are always shown in hexadecimal.


/N:flags disables features:

8do not show dashes between bytes of UTF-8 characters
Bdo not write a BOM (useful when redirecting to a Unicode file)
Cno highlight
Ddo not search into hidden directories (with /S)
Fsuppress file-not-found error messages
Ido not display the address field
Jdo not search into junctions (with /S)
Ldo not add a blank line at the end of each file
Qno fancy Unicode quotes in the header or summary lines
Tdo not display the text field (i.e. characters)
Udo not display non-ASCII characters in the text field
Zdo not search into system directories (with /S)

/C:start, /E:end, and /M:max let you specify a start address, an end address, and a maximum number of bytes to dump. You can enter these values as decimal, or hexadecimal with a leading 0x. You may give none, one, or any combination of these options.

/C:, /E:, and /M: values are all in bytes by default. You can append one of the following letters:

bbytes
wwords
ddoublewords
qquadwords
kthousands of bytes
Kkilobytes (210 or 1,024 bytes)
mmillions of bytes
Mmegabytes (220 or 1,048,576 bytes)
gbillions of bytes
Ggigabytes (230 or 1,073,741,824 bytes)

Note that k K m M g and G are case-sensitive.

If you don’t give any of these suffixes, the value is in bytes — even if you are displaying words or doublewords. There are no alignment checks; you can dump misaligned data if you wish.

/C: and /E: allow you to pass a negative number to specify the address as an offset from the end of the file, e.g. /C:-1K to dump only the last kilobyte of the file. /M: does not allow negative numbers.


/K:n lets you specify the number of bytes to display per line. If you don’t give any /K:, the command will pick its own value based on the console width (if output is to the console), or a default line width of 100 characters if output is redirected. Again, this value is in bytes, even if you are displaying data as words or doublewords. The value n must be between 8 and 80, and a multiple of 8.

/K:0 sets the line length based on the console width, even in cases where HEXDUMP normally would not do so: when output is redirected or piped, e.g. piping to LIST; or in Unixy mode.


/ML:n lets you set a maximum number of data lines to dump. Any header or summary lines are not counted.


/Z:char lets you specify the replacement character, which is shown in the text field in place of control characters. The default is normally a middle dot ·   You may give either a literal character or a character value. All three of the following are equivalent:

•  /Z:*(literal character)
•  /Z:42(decimal value)
•  /Z:0x2a(hexadecimal value)

Your replacement character may not be alphanumeric or a control character. /Z by itself will use a space as the replacement character.


/U selects Unixy mode: the output format is adjusted to look more like hexdump utilities found on various flavors of Unix. 16 bytes of data are displayed per line, unless you set a diffent value with /K:n. Multiple lines with the same data are replaced with a single asterisk. The default replacement character is a period, unless you set a different one with /Z:char.

/U only makes a few cosmetic adjustments to HEXDUMP’s output format. Its basic operation is unchanged, and the output may not be an exact match for any particular Unix utility.

rem   Dump the file Build.txt :
hexdump /hh /i /x build.txt



Reference Information:


Size LimitThere is one, but it varies.
Paging OptionsTo /P, or not to /P ?
Highlight VariableChoose your colors.
Startup Messageand how to suppress it
ChangesWhat’s new?
Status and Licensing 


Size Limit

HEXDUMP may fail on extremely large files (more than a gigabyte or two). The exact upper limit will vary depending on your processor type and Windows edition. X64 Windows will allow much larger files than X86 Windows.

Paging Options:

HEXDUMP has a /P option to page output. This option supports two suboptions:

/P:time,lines

timetime in seconds, or (with a trailing M) milliseconds
linesnumber of lines to display before pausing

Both time and lines are optional. The colon is not required, but you must use the comma if you want to specify lines.

rem  Scroll every five seconds:
hexdump test.bin /p:5

rem  Display ten lines at a time:
hexdump test.bin /p:,10

rem  Display twenty lines at a time, and
rem    scroll every 2.5 seconds:
hexdump test.bin /p:2500m,20


At the “Press a key to continue” prompt, most keys will advance by another screenful (or lines). But a few keys behave differently:

A or Cturns off paging, and scrolls continuously
Esc or Ctrl-Caborts the current command
/scrolls half a screen, or half of lines
1 to 9scrolls that many lines, e.g. 3 scrolls three lines

Highlight Variable:

HEXDUMP features highlighted output when you enable either filename headers with /H or highlighted alternate lines with /J. You can customize this feature by setting an environment variable Highlight:

rem  Disable highlight:
set highlight=none

rem  Set the highlight foreground:
set highlight=bright cyan

rem  Set both foreground and background:
set highlight=bri whi on blu

rem  Numbers are also supported:
set highlight=46

If the Highlight environment variable is not defined, the plugin will check the registry for a value named Highlight of type REG_SZ. The plugin will search, in this order:

•  HKEY_CURRENT_USER\Software\JPPlugins\HexDump(affects this plugin only)
•  HKEY_CURRENT_USER\Software\JPPlugins(affects several of my plugins)

You can also use /NC to disable highlighting.

Startup Message:

This plugin displays an informational line when it initializes. The message will be suppressed in transient or pipe shells. You can disable it for all shells by defining an environment variable named NOLOADMSG, for example:

set /e /u noloadmsg=1

Changes:


0.96.9.12025-08-21/C: /E: and /M: now can combine a multiplier with a word size, e.g. /C:10KW for 10 kilowords = 20,480 bytes.
Additional sanity check/error message for EOF-relative start and end addresses.
0.96.9.02025-08-20/C: and /E: allow negative values to specify the starting/ending address as an offset from the end of the file.
0.96.8.92025-08-06 VLFN display tweak: If the filename has the \\?\ prefix, don’t display the prefix in the filename header.
0.96.8.82025-07-17Returns ERROR_INVALID_PARAMETER if no arguments are passed. (Can’t happen?)
0.96.8.72025-07-07Removes the hex file size from the final summary line. It only cluttered the line without adding any new info.
0.96.8.62025-07-02Pluralizes byte/bytes in the final summary line.
If WordLen > 1, shows the word size and word count instead of the hex file size in the final summary.
0.96.8.52025-06-29In the /I summary line, CLIP: and - were not being handled nicely; fixed.
In the /H and /HH header line, use fancy Unicode quotes around the filename of an actual file, as /I does.
Removed hardcoded \r\n from header and summary lines; now they respect /NL and /CR.
Added /NQ to suppress the fancy Unicode quote marks.
0.96.8.42025-06-15Added /BOM to display any Byte Order Marks (anywhere in the file) as the generic currency symbol ¤. Fixed an issue where an error in /ML: would exit without proper cleanup.
0.96.8.32025-06-13Fixes to the handling of control pictures: Use the user’s specified replacement character if no control picture is available; use the correct control pic for DEL.
0.96.8.02025-06-07Now MaxLines just adjusts EndAddress up front. Much simpler!
0.96.7.02025-06-06Removed the redundant FirstLine variable.
When MaxLines and Unixy mode are both set, fudge the end address so the final bytes-shown summary will be correct.
0.96.6.02025-06-06Added /ML: to set a maximum number of lines to dump.
0.96.5.12025-05-07Unixy mode also disables the UTF-8 dashes.
0.96.52025-05-07When dumping a UTF-8 text file by bytes, show dashes between bytes of a valid character. Added /N8 to disable.
Added support for the NO_COLOR environment variable. If NO_COLOR is defined and HIGHLIGHT is not, disable highlighting as if /D had been specified.
0.96.42025-03-26Highlight the summary line.
Updated conlist.cpp, mmfiles.cpp.
0.96.3.12025-03-20Fixed incorrect buffer length in ShowFilenameHeader().
0.96.32025-03-17Added /X to use control pictures for ASCII control characters.
Fixed an issue which caused the text field to be lost if the final line overlapped the end of the buffer.
Slightly simplified the ‘print word values’ loop.
0.96.22025-01-10Added /F?. Added /F:+ and /F:- as synonyms for /F:S.
0.96.1.12025-01-01Uses CL_ConsoleHandle() from conlist.cpp, instead of duplicating this function. Other trivial code tweaks.
0.96.12024-12-28Rewrote and simplified parsing of /1 /2 /3 … /8.
0.96.02024-12-21Added support for some oddball word sizes. Added /CR, /CRLF, and /LF to select different end-of-line characters. Added /UC to uppercase hex addresses and values. Removed the increasingly Byzantine HexDump_ValWidth() and replaced it with a simple lookup table.
0.95.02024-11-08Added /Q to dump quadwords. Added /F:S to display values as signed decimal. Simplified the data-dump code.
0.94.4.12024-11-06Bug fix: PLUGIN_BUFFER_MAX is 32K bytes, not 32K characters.
0.94.42024-09-19More /Z: tweaks: now the replacement character may be specified by value.
0.94.3.12024-09-18Tweaks to /Z: skip over a colon or equals sign; do not allow multiple characters.
0.94.32024-09-13Added /I to include a final summary line with the number of bytes displayed.
0.94.22024-09-09Added /NU to not display non-ASCII characters. Modified /Z to allow the user to specify the replacement character. If no /Z was given and either Unixy or ASCII-only mode is in effect, then the replacement character defaults to period instead of mid-dot.
0.94.12024-08-22Bug fix: the default HexWidth calculation was not correctly accounting for the width of the address field; fixed.
0.94.02024-08-20Added /J to highlight alternate lines.
0.93.12024-08-19Added w W d D to the size_t parser for words and doublewords.
Added /$ for debug output.
0.93.02024-08-17Wrote a separate parser for size_t arguments. The numeric value may be suffixed with b B k K m M g G for bytes or decimal/binary kilobytes, megabytes, etc.

Status and Licensing:

Consider this beta software. It may well have issues. Try it at your own risk. If you find a problem, you can report it in the JP Software support forum.

HexDump is currently licensed only for testing purposes. I may make binaries and source code available under some free license once I consider it ready for use.

Download:

You can download the current version of this plugin from https://charlesdye.net/dl/hexdump.zip.