[net.micro.pc] Running batch files without echoing commands

schwadro@aecom.UUCP (David Schwadron) (03/18/85)

Hi...

	Does anybody know how to run a batch file in msdos without
any echoing of commands. I hate to use `echo off` as the first command
because then "echo off" is echoed!!

								thanx alot,
								schwady

nather@utastro.UUCP (Ed Nather) (03/19/85)

> Hi...
> 
> 	Does anybody know how to run a batch file in msdos without
> any echoing of commands. I hate to use `echo off` as the first command
> because then "echo off" is echoed!!
> 
> 								thanx alot,
> 								schwady

I always use "echo off" as the first line, followed by the escape sequence
that jumps the cursor to the beginning or the line, then the sequence that
erases the line, then the sequence that moves the cursor up a line (to
compensate for the newline after the "echo off") -- this leaves the screen
and cursor as you would want them, but the "echo off" flashes momentarily
while all this is going on.  Shabby, kludgy, awful -- but it works, if you
have "device=ansi.sys" in your "config.sys" file.

Stuff that provides gratuitous output, like the copy command, can be silenced
by the following:

	copy *.* newdir > nul

By the way -- does anybody know how to rename a directory without creating
a new one and copying all the files into it?
-- 
Ed Nather
Astronony Dept, U of Texas @ Austin
{allegra,ihnp4}!{noao,ut-sally}!utastro!nather

bmarsh@noscvax.UUCP (William C. Marsh) (03/20/85)

> Hi...
> 
> 	Does anybody know how to run a batch file in msdos without
> any echoing of commands. I hate to use `echo off` as the first command
> because then "echo off" is echoed!!
> 
> 								thanx alot,
> 								schwady

Here are the patches to command.com I have been collecting for some
time.  The first patch increases the default environment size from 
128 bytes to 2k. (Or even larger, If you like.).  The second fix is
the method used to patch command to disable echoing of batch file command
lines while in use.  I have used both these patches for some time now,
with no ill effects.  (The method for patching command for echo-off has
been tried (successfully) on pc-dos 2.0, 2.1, 2.11, and generic ms-dos
2.0.

I'm re-posting these since I'm sure somebody missed these when they first
went over the net.

bill marsh

---------------

>From: Craig Milo Rogers  <ROGERS@USC-ISIB.ARPA>

        I patched my COMMAND.COM to use a 2K byte environment.  Start
with DEBUG COMMAND.COM.  Check the location CS:ECE.  In my copy of COMMAND
it is a MOV BX,000A.  Use the Assemble command to insert a new value, the
number of paragraphs of environment space.  I used MOV BX,0080.  Write the
new COMMAND.COM back to disk.  A little caution is in order, such as
comparing the size of the new COMMAND.COM to that of the old COMMAND.COM,
before you execute the new one.

                                        Craig Milo Rogers

>From: Tom Brengle <Brengle@LLL.MFE>

I got at least one request for details on the patch to default ECHO to
off for batch files in DOS 2.x, so I thought I would send them to the
digest.  First, I want to say that I have not modified the original
DOS 2.0 patch in any way except to change appropriate addresses, and
to provide one new option.

I have done this patch for both DOS 2.0 and 2.11 on my Compaq without
any problems.  This procedure requires searching through the
COMMAND.COM file for certain locations which are different in the two
versions.  I will give the addresses which I found as a result of
those searches for both versions.  In the actual patching, though, I
will use the 2.11 addresses as examples, but the user attempting this
procedure will have to use the actual addresses found for his system.

For safety, format a scratch disk with the /S switch to get the system
on it.  Also put DEBUG.COM on it.  (I am going to assume that you have
the 2.1 DEBUG available.)  Now do "DEBUG \COMMAND.COM".

First we want to find the location of the byte which contains the ECHO
flag.  Do

	-S 0 7FFF 01 00 00 01

This search should produce a single response.  The ECHO flag byte is
the last one in the search list, that is, it is located at the address
found by the search plus three more.  In DOS 2.0, the address of the
flag byte is 96E, in 2.11 it is 9B7.

Now we find a location to install patch code by doing

	-S 0 7FFF 61 6E 64 20 70

This search should also produce a unique result.  The resulting
address is where we will install the patch code.  It lies in the
middle of the text strings for a bunch of DOS messages (use the D
command to DEBUG if you want to see what they are).  For 2.0, the
address is 364A and for 2.11 it is 3886.

Next we find the location to install the wedge for the patch by doing

	-S 0 7FFF B9 0A 00 E8

As before, this should produce a unique result.  For 2.0, I got 171D
and for 2.11, I got 17E3.

Now we will install the wedge.  Unassemble beginning at the wedge
location we just determined.  The first instruction should be a
"MOV CX,000A", and this should be followed by a "CALL" instruction.
Record the target address for the "CALL"; we will use that again in the
patch code.  For DOS 2.0, this address is 1E6D, for 2.11, it is 2A10.
Assemble a new "CALL" instruction in place of the old one using the
patch code area address plus one (the plus one is because we have to
put in an "end of string code" in the patch area as the first byte).
So for DOS 2.11, you would

	-A 17E6
		CALL	3887

At the patch code area address, assemble the following (for 2.11):

	-A 3886
		DB	24
		ES:
		MOV	BYTE PTR [9B7], 00
		JMP	2A10

The first line installs an "end of string" to one of the DOS messages
before its normal termination to allow space for the patch code.  The
"MOV BYTE PTR" instruction clears the ECHO flag; the BYTE PTR address
is the address we found earlier for that flag byte.  The jump
instruction jumps off to the subroutine that used to be called before
we installed the wedge.  This address was found when we unassembled
the "CALL" instruction.

That's all there is to the patch.  An additional note is that by using
the "E" (ENTER) command in DEBUG, you can install a zero in the ECHO
flag byte.  This will shut off echo at boot-up, so that even your
AUTOEXEC.BAT won't be echoed.  For 2.11, do

	-e 9B7 00

Now write out the file and quit:

	-w
	-q

I hope this works for all 2.x.  Please let me know if it doesn't.  I
apologize for the long message, but hope that it is helpful.

	Tom
-- 

Bill Marsh
Naval Ocean Systems Center
San Diego, CA

	ihnp4  \			MILNET bmarsh@nosc
	akgua   \
UUCP 	decvax 	 >------------!sdcsvax!noscvax!bmarsh
	dcdwest / 
	ucbvax /

"burning the candle at both ends, twice the light in half the time..."

rsellens@watdcsu.UUCP (Rick Sellens - Mech. Eng.) (03/21/85)

In article <1128@utastro.UUCP> nather@utastro.UUCP (Ed Nather) writes:
>> Hi...
>> 
>> 	Does anybody know how to run a batch file in msdos without
>> any echoing of commands. I hate to use `echo off` as the first command
>> because then "echo off" is echoed!!
>> 
>> 								thanx alot,
>> 								schwady
>
>I always use "echo off" as the first line, followed by the escape sequence
>that jumps the cursor to the beginning or the line, then the sequence that
>erases the line, then the sequence that moves the cursor up a line (to
>compensate for the newline after the "echo off") -- this leaves the screen
>and cursor as you would want them, but the "echo off" flashes momentarily
>while all this is going on.  Shabby, kludgy, awful -- but it works, if you
>have "device=ansi.sys" in your "config.sys" file.
>
>Stuff that provides gratuitous output, like the copy command, can be silenced
>by the following:
>
>	copy *.* newdir > nul

Any text following "echo off" on the same line is ignored by the batch
processor, but echoed to the screen. I put an identifying message in this
area to describe the routine that's been invoked. I think this is less
ugly than an "echo off" all by itself.

Redirection to nul keeps things nice and neat, but I found that when used
in my autoexec it caused some obscure bugs to appear in some of the stuff
I was loading in over DOS. I don't know why, but it might be something to
check if strange things start happening.


Rick Sellens
UUCP:  watmath!watdcsu!rsellens
CSNET: rsellens%watdcsu@waterloo.csnet
ARPA:  rsellens%watdcsu%waterloo.csnet@csnet-relay.arpa

turek@brl-tgr.ARPA (C. A. Turek <turek>) (03/23/85)

  I use the prompt command to set the screen print off.

		PROMPT $E[8m

as the first line of the AUTOEXEC.BAT then cls for the next line to
clear the screen. It take only about half a second to execute and leaves
the screen blank until you reset the prompt again. Another method is to
do a cls after the `echo off' this allows printing of other remarks,
etc. to be printed to the screen.


			Chris....


turek@brl-tbd.arpa
CAT@BRL