Ok, this is a batch group but not knowing the target OS, this solution
is a vbscript for Win98+ systems.
'hexdump.vbs
'Usage:
'cscript /nologo hexdump.vbs <infile.ext >hexdump.txt
'cscript /nologo hexdump.vbs -r <hexdump.txt >outfile.ext
'
Dim StdIn, StdOut
Set StdIn = WScript.StdIn
Set StdOut = WScript.StdOut
If WScript.Arguments.Count = 0 Then
Do While Not StdIn.AtEndOfStream
StdOut.Write Right("0"+Hex(Asc(StdIn.Read(1))),2)
n = n + 1
If n = 35 Then
n = 0
StdOut.Write vbCrLf
End If
Loop
ElseIf WScript.Arguments.count = 1 Then
If Lcase(WScript.Arguments(0)) = "-r" Then
Do While Not StdIn.AtEndOfStream
str = StdIn.ReadLine
For i = 1 to Len(str) step 2
StdOut.Write Chr("&H"+Mid(str,i,2))
Next
Loop
End If
End If
Now, you can either use it on command line using the syntax as shown at
the top of the script, or create a batch wrapper to invoke it. This is a
simple batch example without any error trapping. I leave it for you to
improve as deemed necessary.
::hexdump.bat
@echo off
if %1.==-r. goto :reverse
cscript /nologo hexdump.vbs <%1 >%2
goto :eof
::
:reverse
cscript /nologo hexdump.vbs -r <%2 >%3
:eof