ECHO bug

echo "[!-- macro Moved reunion/reunion.html --]" ] E:\mindprod\reunion\index.html

Angle brackets are shown as square brackets.

Puts the text in the index.html but also the surrounding quotes.

I did not notice this before because I used my own MASM Echo-like utility that stopped working with Windows 7.

If you figure it is too late now to fix this, please warn folks in the documentation.
 
May 20, 2008
603
0
Sammamish, WA
I've had issues with that before. Somehow the quoting behavior in ECHO more
often surprises me than in other commands. I believe that using back quotes
has always worked for me. This assumes you can change your source.

echo `[!-- macro Moved reunion/reunion.html --]` ]
E:\mindprod\reunion\index.html

On Thu, Jan 28, 2010 at 6:54 AM, Roedy <> wrote:


> echo "[!-- macro Moved reunion/reunion.html --]" ]
> E:\mindprod\reunion\index.html
>
> Angle brackets are shown as square brackets.
>
> Puts the text in the index.html but *also* the surrounding quotes.
>
> I did not notice this before because I used my own MASM Echo-like utility
> that stopped working with Windows 7.
>
> If you figure it is too late now to fix this, please warn folks in the
> documentation.
>
>
>
>
>



--
Jim Cook
2010 Sundays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Monday.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Roedy wrote:
| echo "[!-- macro Moved reunion/reunion.html --]" ]
| E:\mindprod\reunion\index.html
|
| Angle brackets are shown as square brackets.

Do you mean in your example above you used braces "[]" where the command had
angle brackets "<>"?

| Puts the text in the index.html but *also* the surrounding quotes.

AFAIK it has worked that way even in 4DOS. If you use the accent grave (also
known as back-tick, `) to quote the text you will observe what you
apparently desire, i.e. the command below (using your angle bracket to brace
substitution)

echo `[!-- macro Moved reunion/reunion.html --]` ]
E:\mindprod\reunion\index.html

will store

[!-- macro Moved reunion/reunion.html --]

in the target file. Note that any character other than the ` character
itself is written to the target without interpretation.

Another method of writing text containing characters meaningful to the
parser is the use of the TEXT command:

TEXT ] E:\mindprod\reunion\index.html
[!-- macro Moved reunion/reunion.html --]
ENDTEXT

--
HTH, Steve
 
May 20, 2008
11,391
99
Syracuse, NY, USA
Those characters could also be escaped with ^.

And their special meaning can be turned off with SETDOS /X-6.

On Thu, 28 Jan 2010 10:28:22 -0500, Steve Fábián <> wrote:

|Roedy wrote:
|| echo "[!-- macro Moved reunion/reunion.html --]" ]
|| E:\mindprod\reunion\index.html
||
|| Angle brackets are shown as square brackets.
|
|Do you mean in your example above you used braces "[]" where the command had
|angle brackets "<>"?
|
|| Puts the text in the index.html but *also* the surrounding quotes.
|
|AFAIK it has worked that way even in 4DOS. If you use the accent grave (also
|known as back-tick, `) to quote the text you will observe what you
|apparently desire, i.e. the command below (using your angle bracket to brace
|substitution)
|
|echo `[!-- macro Moved reunion/reunion.html --]` ]
|E:\mindprod\reunion\index.html
|
|will store
|
|[!-- macro Moved reunion/reunion.html --]
|
|in the target file. Note that any character other than the ` character
|itself is written to the target without interpretation.
|
|Another method of writing text containing characters meaningful to the
|parser is the use of the TEXT command:
|
|TEXT ] E:\mindprod\reunion\index.html
|[!-- macro Moved reunion/reunion.html --]
|ENDTEXT
--
- Vince
 

rconn

Administrator
Staff member
May 14, 2008
12,340
149
> echo "[!-- macro Moved reunion/reunion.html --]" ]
> E:\mindprod\reunion\index.html
>
> Angle brackets are shown as square brackets.
>
> Puts the text in the index.html but *also* the surrounding quotes.
>
> I did not notice this before because I used my own MASM Echo-like
> utility that stopped working with Windows 7.
>
> If you figure it is too late now to fix this, please warn folks in the
> documentation.

This is WAD; definitely *not* a bug. (It's also exactly how CMD.EXE
behaves.)

Did you expect ECHO would remove double quotes? (If so, why?)
 
Similar threads
Thread starter Title Forum Replies Date
fpefpe How to? command echo in title line/bar Support 2
vefatica @EXECSTR clobbers @ECHO ON Support 2
L WAD ECHO. expansion of non-existent env-vars differs from CMD.exe Support 6
D Does TCC improve CMD's implementation of ECHO? Support 6
E My echo full file name to the clipboard fails now. Support 2
MickeyF how to ECHO in opposite colors? Support 12
Joe Caverly Echo message works without the space? Support 3
T Fixed Echo randomly activated in script Support 4
S How to? ^C echo Support 6
vefatica ECHO is very slow Support 9
J How to? Riddle: How to echo > into a file? Support 7
Alexander How to? how can I use Cyrillic characters in the Echo command? Support 8
jadaml Echo unicode characters from UTF-8 Batch files? Support 1
vefatica WAD DO, ECHO, and trailing whitespace Support 3
nickles WAD echo "%PROGRAMFILES(X86)%" Support 16
J Can you redirect output to printer device with echo? Support 1
M How to? Save and then restore "Echo" status Support 2
T Set 1% then Echo 1% Support 9
M echo %@index[1234,.,-1] return -21 in new version Support 3
T How do you echo lines with special characters to file? Support 4
Dick Johnson v28 Cosmetic Bug Support 0
Jay Sage WAD Possible Bug With OPTION Command With @FILE Support 5
R strange bug? Support 7
Jay Sage Bug With Flow Control and/or Command Grouping Support 2
M Server 2019 Bug with @execstr? Support 14
R bug _ypixels in BDEBUGGER Support 6
E Fixed Bug with DIR /Z displaying descriptions Support 8
E Text copy bug Support 1
x13 SETARRAY /Z bug Support 6
Gamegod ffind bug with chinese Support 2
Dick Johnson cdd - is this a bug or a feature? Support 7
P "Set" command behavior - a bug? Support 3
nikbackm TCC 20 variable expansion bug Support 6
gentzel Bug launching external commands in 20.11.43 Support 11
R Is this a bug in SETARRAY? Support 2
M Windows Installer bug? Support 4
vefatica @SCRIPT bug persists Support 4
M Little bug, big consequences .. Support 6
fishman@panix.com Once again the Can't Install bug bites... Support 2
gentzel Fixed dirs +n bug in 20.0.12 x64 Support 2
M Bug in Windows 10, when adding symbol to task bar Support 6
Alpengreis [Bug?] View (V) Prefs Error (TC 18.00.27 x64) Support 4
D WAD Minor Post Installation Bug in V18 Support 1
I Possible Bug: History /n Returns Nothing Support 3
samintz WAD Weird REN bug Support 6
Jay Sage WAD Possible Bug in Batch Parameters Support 7
G Bug? TCC 16.03.55 Console Palette Support 4
S Return of FTP copy bug in 16.02.48 Support 12
S XenForo bug Support 3
D TCMD16 Delete Toolbar Button bug Support 7

Similar threads