WAD DO, ECHO, and trailing whitespace

May 20, 2008
11,547
107
Syracuse, NY, USA
Can you please change this behavior?
Code:
v:\> echos foo^t & echo bar
foo    bar

v:\> (echos foo^t & echo bar)
foo    bar

v:\> do i=1 to 5 (echos foo^t & echo bar)
foobar
foobar
foobar
foobar
foobar
 
May 20, 2008
11,547
107
Syracuse, NY, USA
Shouldn't you be doubling the carat in the last example?
Yeah! Thanks! But it doesn't make a heck of a lot of sense (the memorable kind of sense) ... I don't have to double %s but I do have to double ^s.
Code:
v:\> do i=1 to 5 (echos %_second^^s & delay 1 )
40 41 42 43 44
 

rconn

Administrator
Staff member
May 14, 2008
12,406
152
WAD - the ( ) in a DO is not a command group, it's a command line to execute. The ^ is parsed and expanded before the DO is executed. This is no different from a FOR argument list.

And no, it can't be changed (but I could remove the DO () syntax if you prefer).
 
Similar threads
Thread starter Title Forum Replies Date
old coot Spurious errors (triggered by "for" construct?) when adding/removing "echo" lines Support 2
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
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
Roedy ECHO bug Support 4
T How do you echo lines with special characters to file? Support 4
JohnQSmith Trailing backslash Support 10
Eric Peters Fixed TREEEXCLUDE trailing semi-colon Support 4
JohnQSmith ECHOS and trailing spaces Support 4
E Fixed DEDUPE doesn't handle filenames with whitespace properly when symlinking Support 1
C View Print Wrap - please break at whitespace Support 3
samintz How to? read while ignoring whitespace Support 3

Similar threads