[comp.sys.ibm.pc.misc] ECHOing > <

cgordon@vpnet.chi.il.us (Crash Gordon) (12/04/90)

>Author: [Henk Fictorie]
>In a bat file I would like to ECHO the special characters: < > | &.

>Author: [Rolf Michelsen]
>I haven't tested this, but the standard way of passing special characters 
>as parameters is to enclose the entire parameter in double quotes. You
>could try something like this:  ECHO "this is a <silly> test"

Rolf's solution does work.  You can even do things like
     ECHO This is a "<" less than test.
But the double quotes are echoed as well.  I don't know how to get the
characters without the quotes politely.

There is a kludge you can use:  Echo using the double quotes, and after each
double quote leave a space.  Then go back with a binary editor (like DEBUG)
and replace the space character with a backspace ('08).  COMMAND.COM will
still recognize and process the double quotes, but will then backspace over
them and they won't show.  To get rid of the last character on a line, you
have to have a space _after_ the backspace.

Like this:
67AC:0100  40 65 63 68 6F 20 6F 66-66 0D 0A 65 63 68 6F 20   @echo off..echo
67AC:0110  22 08 54 68 69 73 20 77-6F 72 6B 73 21 20 3C 3E   ".This works! <>
67AC:0120  7C 26 22 08 20 0D 0A                              |&". ..

You should document this in a REM statement, however, since TYPEing the file
will not display the quotes -- the backspace character eats them quite
effectively!

-----------------------------------------------------
Gordon S. Hlavenka            cgordon@vpnet.chi.il.us
Disclaimer: I don't know what 4DOS would do with this