[comp.sys.ibm.pc] How do I ECHO a blank line from batch file?

du4@mace.cc.purdue.edu (Ted Goldstein) (03/29/90)

The other day while working on a little batch file I wanted to 
put a blank line between two small paragraphs of text that get
ECHOed to the screen, and was unable to do so. If you use ECHO
by itself, it says 'ECHO is off'. I tried putting  some spaces
after it, but it didn't help. There should be simple answer to
this, but I seem to be missing it. Any advice would be greatly
appreciated.

LC.YRS@forsythe.stanford.edu (Richard Stanton) (03/29/90)

In article <4522@mace.cc.purdue.edu>,
du4@mace.cc.purdue.edu (Ted Goldstein) writes:
>The other day while working on a little batch file I wanted to
>put a blank line between two small paragraphs of text that get
>ECHOed to the screen, and was unable to do so. If you use ECHO
>by itself, it says 'ECHO is off'. I tried putting  some spaces
>after it, but it didn't help. There should be simple answer to
>this, but I seem to be missing it. Any advice would be greatly
>appreciated.

Try

echo.

Richard Stanton

horvath@granite.cr.bull.com (John Horvath) (03/29/90)

In article <4522@mace.cc.purdue.edu> du4@mace.cc.purdue.edu (Ted Goldstein) writes:
>The other day while working on a little batch file I wanted to 
>put a blank line between two small paragraphs of text that get
>ECHOed to the screen, and was unable to do so. If you use ECHO
>...

I couldn't figure out a way with ECHO either, so I used a program to
output a CR-LF and referenced in the BAT file like:

	C:\tools\cr.exe
	echo This text is surrounded by two blank lines.
	C:\tools\cr.exe

You could make cr.exe in either C with:
	main() { printf("\n"); }

But the .exe will take up 7000 bytes or do it in assembler and use
only 500. Not being a fluent assembler programmer, the following
example could probably be abreviated.

;Turbo assembler source for outputing CR-LF
; TASM cr.asm
; TLINK cr.obj
;
	DOSSEG
	.MODEL SMALL
	.STACK 100H

	.DATA
cr_chr	db 13,10,'$'

	.CODE
crlf	proc	near

; set up data segement
	mov	ax,@Data
	mov	ds,ax

; print out the string
	mov	ah,9
	mov	dx, OFFSET cr_chr
	int	21h

; exit code
	mov	ah,4ch
	int	21h

crlf	ENDP
	end	crlf

du4@mace.cc.purdue.edu (Ted Goldstein) (03/29/90)

In article <8710@lindy.Stanford.EDU> LC.YRS@forsythe.stanford.edu (Richard Stanton) writes:
->In article <4522@mace.cc.purdue.edu>,
->du4@mace.cc.purdue.edu (Ted Goldstein) writes:
->>put a blank line between two small paragraphs of text that get
->>ECHOed to the screen, and was unable to do so. If you use ECHO
->Try
->
->echo.
->
->Richard Stanton


Thank you Richard, and all the kind folks who sent me E-mail. After
some quick tests I found that 'ECHO.' , 'ECHO\' and ECHO '<ALT255>'
all will echo a blank as I wanted. Those of you who said in E-mail 
that you use ALT255 but found it cumbersome should give echo. a try.
Thanks again !

sbnicol@rose.waterloo.edu (Scott Nicol) (03/29/90)

In article <4522@mace.cc.purdue.edu> du4@mace.cc.purdue.edu (Ted Goldstein) writes:
>The other day while working on a little batch file I wanted to 
>put a blank line between two small paragraphs of text that get
>ECHOed to the screen, and was unable to do so. If you use ECHO
>by itself, it says 'ECHO is off'. I tried putting  some spaces
>after it, but it didn't help. There should be simple answer to
>this, but I seem to be missing it. Any advice would be greatly
>appreciated.

   Try echoing a backspace.  Seriously, it worked for me.  The line
would look something like:

	echo \8

where \8 is the backspace character.  You should be able to generate it
by holding down the alt key, hitting 8 on your numeric keypad, and
then releasing the alt key.  If your editor doesn't like this, you could
always enter it as "echo  " and use debug to change the second space
to a backspace.

- Scott

metzger@cup.portal.com (David G Metzger) (03/29/90)

du4> The other day while working on a little batch file I wanted to
du4> put a blank line between two small paragraphs of text that get
du4> ECHOed to the screen, and was unable to do so. If you use ECHO
du4> by itself, it says 'ECHO is off'. I tried putting  some spaces
du4> after it, but it didn't help. There should be simple answer to
du4> this, but I seem to be missing it. Any advice would be greatly
du4> appreciated.

A null character (control-@) after the "echo" command works fine with
MS-DOS 3.20.

For example:

    echo This prints on line 1.
    echo <insert null character here>
    echo This prints on line 3.

Of course you're editor will have to allow you to put a "nul" there.
(I use Sidekick's notepad editor for quick and dirty stuff like this.)

                                   David Metzger
                                   metzger@cup.portal.com
                                   sun!portal!cup.portal.com!metzger

saj@yipeia.Sun.COM (Scott A. Jordahl) (03/29/90)

In article <22610@watdragon.waterloo.edu> sbnicol@rose.waterloo.edu (Scott Nicol) writes:
>In article <4522@mace.cc.purdue.edu> du4@mace.cc.purdue.edu (Ted Goldstein) writes:
>>The other day while working on a little batch file I wanted to 
>>put a blank line between two small paragraphs of text that get
>>ECHOed to the screen, and was unable to do so. If you use ECHO
>>by itself, it says 'ECHO is off'. I tried putting  some spaces
>>after it, but it didn't help. There should be simple answer to
>>this, but I seem to be missing it. Any advice would be greatly
>>appreciated.
>
>   Try echoing a backspace.  Seriously, it worked for me.  The line
>would look something like:
>
>	echo \8
>
>where \8 is the backspace character.  You should be able to generate it
>by holding down the alt key, hitting 8 on your numeric keypad, and
>then releasing the alt key.  If your editor doesn't like this, you could
>always enter it as "echo  " and use debug to change the second space
>to a backspace.
>
>- Scott

No. No. No. No.  The solution is very simple:  

			echo"  
			
(Notice: double quote, no space)

I use this all the time in my .bat files.

-- Scott

|=|=|=|=|=|    Scott A. Jordahl             |=|=|=|=|=|
|==|=|=|==|    UUCP:   saj@sun.COM          |==|=|=|==|
|=|=|=|=|=|    PHONE:  Wk: [415] 336-5463   |=|=|=|=|=|
|==|=|=|==|            Hm: [408] 270-5619   |==|=|=|==|

dmlkm@cbnewse.ATT.COM (david.e.montalbano) (03/29/90)

I mean use echo followed by a colon.  It took me some time to 
finally figure this out after having the same problem as you.
No one I knew has the right answer.  

johnlee@pnet07.cts.com (John Wiley) (03/29/90)

Someone may have already said this, but I've found that Alt-255 works in every
DOS version I've tried it on.  In your batch file, at the start of the line
type ECHO, hit the spacebar, hold down the Alt key and type 255 on the
**NUMERIC** keypad (doesn't matter if Num Lock is on or off), and hit Enter. 
This echos a "hard space" with an ASCII value of 255 decimal.  It looks like a
regular space (invisible), but DOS handles it differently.


Statements herein are my own.

UUCP: nosc!pnet07!johnlee   (John Wiley - San Diego, CA.)
ARPA: simasd!pnet07!johnlee@nosc.mil
INET: johnlee@pnet07.cts.com

ts@uwasa.fi (Timo Salmi LASK) (03/29/90)

Try this:
echo.
No blank between echo and .

...................................................................
Prof. Timo Salmi        (Moderating at anon. ftp site 128.214.12.3)
School of Business Studies, University of Vaasa, SF-65101, Finland
Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun

mrm@sceard.Sceard.COM (M.R.Murphy) (03/29/90)

Try ECHO"

That's the word ECHO followed immediately by a double quote, followed
by a carriage return.
--
Mike Murphy  Sceard Systems, Inc.  544 South Pacific St. San Marcos, CA  92069
mrm@Sceard.COM        {hp-sdd,nosc,ucsd,uunet}!sceard!mrm      +1 619 471 0655

strike@clmqt.marquette.Mi.US (Tim Bowser) (04/10/90)

davidsen@sixhub.UUCP (Wm E. Davidsen Jr) writes:

>Add a dot (ECHO.). This *is* in the manual, I found it there once upon a
>time, but I couldn't find it again to tell you where I found it.
>Obscure, and all that.
>-- 
>bill davidsen - davidsen@sixhub.uucp (uunet!crdgw1!sixhub!davidsen)
>    sysop *IX BBS and Public Access UNIX
>    moderator of comp.binaries.ibm.pc and 80386 mailing list
>"Stupidity, like virtue, is its own reward" -me

   ECHO. is for MS-DOS 3.3 and up.  Having used DOS 3.2 for awhile, I 
know that trick doesn't work with it or lower (Sister swiped some of my 
batch files for use on her 2.11 based machine).

   The <alt>255 trick might not be documented per se in the DOS manuals, 
but is a recommended procedure in the DOS Power Tools book from PC Mag.  
I have seen and used it with all flavors of DOS and have yet to see it 
cause any grief.

   ECHO . is not the same as (echo.).  NO space between, or it will echo 
the dot in any version of DOS.

-- 
 Tim Bowser  ("Strikemaster")  |  Standard  |  mailrus!sharkey!clmqt!strike
Enterprise Information System  | Disclaimer |  strike@clmqt.marquette.Mi.US
      Marquette, Mi. USA       |    Here    |     Voice:(906)-346-6735
=> UNIX: The Adventure Begins... To vi, or not to vi, that is the question. <=

wb@cbnewsj.ATT.COM (werner.baumgartner) (04/11/90)

In article <1990Apr10.035600.22405@clmqt.marquette.Mi.US> strike@clmqt.marquette.Mi.US (Tim Bowser) writes:
>davidsen@sixhub.UUCP (Wm E. Davidsen Jr) writes:
>
>   ECHO. is for MS-DOS 3.3 and up.  Having used DOS 3.2 for awhile, I 
>know that trick doesn't work with it or lower (Sister swiped some of my 
>batch files for use on her 2.11 based machine).
>

I use ECHO. with DOS 3.2 and it works just fine. (My 2 $)

barron@eniac.seas.upenn.edu (Daniel P. Barron) (04/11/90)

[original post asking how to echo blank lines lost]

In article <1990Apr10.035600.22405@clmqt.marquette.Mi.US> strike@clmqt.marquette.Mi.US (Tim Bowser) writes:
>   The <alt>255 trick might not be documented per se in the DOS manuals, 
>but is a recommended procedure in the DOS Power Tools book from PC Mag.  
>I have seen and used it with all flavors of DOS and have yet to see it 
>cause any grief.

Easiest way I've found is to echo a control-h.  There should be a way
in any word process to quote a control character into your document.
Often it's CRTL-Q (for quote) or something similar.  So you type

  echo [^Q][^H]

The ^Q should not appear and your line should look like:

  echo ^H

which will echo a blank, and it should not interfere with anything.
CTRL-H is just a backspace, after all.

Surely this is a well known trick, no?

db

p.s. Apologies if this has been posted already.


_______________________________Daniel Barron__________________________________
 "All I ask                          | E-mail: barron@wharton.upenn.edu
    is a chance to prove             |         barron@eniac.seas.upenn.edu
      that money                     |         barron@scrolls.wharton.upenn.edu
        can't make me happy."        | USMail: Suite 1400, 3620 Locust Walk
_____________________________________|_________Philadelphia, PA  19104________

cs4g6ag@maccs.dcss.mcmaster.ca (Stephen M. Dunn) (04/12/90)

In article <1990Apr10.035600.22405@clmqt.marquette.Mi.US> strike@clmqt.marquette.Mi.US (Tim Bowser) writes:
$   ECHO. is for MS-DOS 3.3 and up.  Having used DOS 3.2 for awhile, I 
$know that trick doesn't work with it or lower (Sister swiped some of my 
$batch files for use on her 2.11 based machine).

   It worked on MS-DOS 3.20 on my old machine.

-- 
               More half-baked ideas from the oven of:
****************************************************************************
Stephen M. Dunn                               cs4g6ag@maccs.dcss.mcmaster.ca
     <std_disclaimer.h> = "\nI'm only an undergraduate ... for now!\n";

cze2529@dcsc.dla.mil ( David E Gaulden) (04/13/90)

In article <2623BF52.22327@maccs.dcss.mcmaster.ca> cs4g6ag@maccs.dcss.mcmaster.ca (Stephen M. Dunn) writes:
>In article <1990Apr10.035600.22405@clmqt.marquette.Mi.US> strike@clmqt.marquette.Mi.US (Tim Bowser) writes:
>$   ECHO. is for MS-DOS 3.3 and up.  Having used DOS 3.2 for awhile, I 
>$know that trick doesn't work with it or lower (Sister swiped some of my 
>$batch files for use on her 2.11 based machine).
>
>   It worked on MS-DOS 3.20 on my old machine.
>
Try using copy con to create your batch file.  When a blank line is
needed type ECHO followed by a <space> and a F7. The batch file will
look like this when typed in copy con.  When run it will result in a 
blank line being transmitted to stdout.  Don't know which versions of
DOS this works under, but hasn't failed me yet.

echo off
echo This is a test
echo ^@
echo End of test
^Z