Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Make .com files just using echo?

19 views
Skip to first unread message

Outsider (6.22/3.11)

unread,
Sep 8, 1999, 3:00:00 AM9/8/99
to
Does anyone know haw to make .com files ą la Herbert Kleebauer?


@echo off
echo BATCH_INPUT___hhQX-PPP^XPPP D"HH0D40DF0De0Dgs>myinput.com
echo myinput.bat hoAX5@@PZYh@xX5@D3!r/P[VX,b,.PZh>>myinput.com
echo X3!X2DqP,{,{PYX4=0DqVX,j,.PZh@@X3!=set input>>myinput.com
echo Enter name:
myinput.com
call myinput.bat
del myinput.com
del myinput.bat
echo You entered %input%

This works with DOS and in a NT DOS-box, but not if you start the batch
file with the NT explorer (then " ^ & are not allowed within the echo
command). Use the following code instead:

echo BATCH_INPUT___hgQX-PPP_XPPP E#HH0E50EG0Ef0Ehs>myinput.com
echo myinput.bat hoAX5@@PZYh@xX5@D3!r/P[WX,b,-PZh>>myinput.com
echo X3!X2ErP,{,{PYX4=0ErWX,j,-PZh@@X3!=set input>>myinput.com

Does anyone have any examples?
Does anyone have a clue? I know I don't.

Regards,
Outsider

bma...@iglou.com

unread,
Sep 8, 1999, 3:00:00 AM9/8/99
to

On 1999-09-08 ipros...@yahoo.com said:
>Does anyone know haw to make .com files à la Herbert Kleebauer?
You need to know assembly language to create a file in which all instructions
and operands are bytes in the range 20 hex to 7E hex. It's easier to create
a file that can be piped to Debug.

Net-Tamer V 1.08X - Test Drive

Herbert Kleebauer

unread,
Sep 9, 1999, 3:00:00 AM9/9/99
to
In article <37d6...@news.iglou.com> bma...@iglou.com writes:
>Subject: Re: Make .com files just using echo?

>>
>>This works with DOS and in a NT DOS-box, but not if you start the batch

>>file with the NT explorer (then " ^ &amp; are not allowed within the echo


>>command). Use the following code instead:
>>
>>echo BATCH_INPUT___hgQX-PPP_XPPP E#HH0E50EG0Ef0Ehs>myinput.com
>>echo myinput.bat hoAX5@@PZYh@xX5@D3!r/P[WX,b,-PZh>>myinput.com
>>echo X3!X2ErP,{,{PYX4=0ErWX,j,-PZh@@X3!=set input>>myinput.com

>>echo Enter name:
>>myinput.com
>>call myinput.bat
>>del myinput.com
>>del myinput.bat
>>echo You entered %input%
>>

>>Does anyone have any examples?
>>Does anyone have a clue? I know I don't.

You must be familiar with assembler programming and the binary codes
of the processor instructions to directly write ascii-only com programs.
But this makes sense only for very short programs. Another example
is the echoo program. echoo does the same as echo, but without
appending an <CR><LF> to the text. echoo can be used e.g. for
dynamically genertating batch files within the original batch file.
The example below saves the current working directory, changes to \DOS
and later restores the old working directory:

echo jP[h01X-00P_j@X(E.(E9,`,`0E50E:h02X500YQ2O0IIxKZR2W2CM!Iy5C>echoo.com
echoo set echoo=>echoo.bat
cd >>echoo.bat
call echoo.bat
del echoo.com
del echoo.bat
rem change to new drive and directory und start program
c:
cd \dos
dir
rem restore old drive and directory, works only with DOS not NT!
%echoo%\
cd %echoo%
set echoo=

For larger programs (more than a few bytes) it is simpler to use
a program to convert a normal com program to an ascii-only program.
The batch below does this job. NOTE: you must assemble your com
program with ORG=0x178 because the first 120 Bytes are needed for
the decoding routine which is inserted by the CONVERT program.
Six bits of the original com program are coded in one ascii-byte,
so your program must not exceed 47 kByte. The decoding routine of
CONVERT is (just as MYINPUT and ECHOO) directly written with
ascii-only opcodes, the rest of the program is a normal com program,
convered by itself to ascii only bytes.

rem - save the lines below as CONVERT.BAT
rem - write a COM program and assemble it with ORG=0x178 (PROG.COM)
rem (you must not use the standard ORG=0x100 for this com programs!!!!)
rem - enter: CONVERT PROG.COM PROG.BAT
rem - the BATCH file PROG.BAT contains an encoded form of PROG.COM

@echo off
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>bat.com
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU!WvX0GwUY Wv;ovBX2Gv0ExGIuht6>>bat.com
echo ??wQ@tyM?WxI?@zA=`Lbw?y_y~?_xA[bz?B_L??oAN`_H?e?as?Fx?pkz?>>bat.com
echo B_}A[aIA]b@MCs?A_rVAgr?\gBGpangV_~r?TO?wGJLy?hKxAG@z?G`L?K>>bat.com
echo K?wQO`LRaRPdwA_by??cxA_bL?@O=Et`x?y_z?P_L?@oXZ`SdBW\ngbTiA>>bat.com
echo _Syi?To_gD_lWPOOnSOOOTg`ODgDCDgLCDgNCDggCDgrKDgtKDgWKDYdKT>>bat.com
echo \QQTDDDTQXTTCqWP}=w@s`aTnbmSILl@gbdTo_n@EwCTokO@mwWDOosPW=>>bat.com
echo kOrFsTnsAP~c?@xHOTV`TPoWuDTvFTV_XPnzuPWAuTuFqSwDoStHFTusgD>>bat.com
echo a}}Oms`DlnbTdILOngbT}o_?`a}SbmsPLlnD??I??~?OBA@TEDCTHGFTKJ>>bat.com
echo ITNMLTQPOTTSRTWVUTZYXTp\[D`_1TcbaTfedTihgTlkjTonmTrqpTutsT>>bat.com
echo xwvT=zyD?}=D????}}??s`aTnbmSILl@gbdTg_nP0>>bat.com
bat.com <%1 >%2
del bat.com


An example for a program generated with CONVERT is echoo2. echoo2
does the same as echoo, but you can also include binary characters
by specifying the hexcode:

@echo off
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>echoo.com
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU!WvX0GwUY Wv;ovBX2Gv0ExGIuht6>>echoo.com
echo ?A}I}KIuwHHTCI[GAGExtc{OCIKGMgELCI?GGgELAs?GH`LRBcx=k_K?Ax>>echoo.com
echo VD?fCo?CaBBHAv0>>echoo.com

echoo This line contains $3c $3e $7c $25 and $24 $0d$0a
del echoo.com

As another example you can use this methode to generate a hex-to-binary
converter with ascii-only opcodes. This allows it to include any binary
file into a batch file:

@echo off
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>hex2bin.com
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU!WvX0GwUY Wv;ovBX2Gv0ExGIuht6>>hex2bin.com
echo ~~=}p~sA@xZJXy?w`L@KH}q@Fs?V@X_Mqo{Ox{fBkCv@KjoK{_K?Xq`tve>>hex2bin.com
echo {SVkTRw\v1_?G{YaCwFj@{YE?o?s@W?@zA?@xA@YyMr`LR?ssY?AzA?FxA>>hex2bin.com
echo @ZyMw`LbLK?s??`?qqdTLqnDLqIC0>>hex2bin.com

echo fcbe3301bf4301b95000b020f3aa89fab91000f3a4bbffffb93c00b409cd > demo.hex
echo 21b40bcd2108c0750801dae2f0f7dbebe9b44ccd21707265737320616e79 >> demo.hex
echo 206b65790d0a24 >> demo.hex

hex2bin <demo.hex >demo.com
del demo.hex
del hex2bin.com
demo.com
del demo.com


0 new messages