Single-line Do-CMD is a bit uncooperative.

I tried to remove some old DOS/CMD-klutches, e.g. replacing Echo. by Echo ``, but
1613577975309.png

That means : Do 5 (Echo.) is working, Echo ``,Screen %_row %_column ^r^n is not.
Why ?
 

samintz

Scott Mintz
May 20, 2008
1,475
15
Solon, OH, USA
There's nothing wrong with using "echo." The other issues seem related to parsing. If you escape the backticks, it works.
Code:
do 5 (echo ^` ^`)
I tried this
Code:
$ do 5 (echo %_row, %_column)
40, 0
40, 0
40, 0
40, 0
40, 0
And if I doubled the percents, it just echoed the text '%_row %_column'
So I don't know how to fix that.
 
May 20, 2008
11,041
90
Syracuse, NY, USA
The ^r^n is disappearing and there is no text for the SCREEN command. If 5 blank lines is what you really want, this works.

1613581995581.png


It's the same with ECHO.

1613582259094.png
 
May 20, 2008
11,041
90
Syracuse, NY, USA
Well, for that matter, this does too:
Code:
echo %@repeat[^n,5]``
Scott, do you have any idea why the `` makes that work when it otherwise fails?

I tried this (below) with somewhat surprising results.

Code:
v:\> echo %@repeat[^^n,5]
^^^
 

samintz

Scott Mintz
May 20, 2008
1,475
15
Solon, OH, USA
My guess is that whitespace is normally stripped from the end of a command line. And the `` says keep all the stuff before it.
Same reason why echo `` works vs echo followed by spaces.
 
My guess is that the DO-command parser goes another way as the other parsers, for example the (peculiar) FOR will work as expected:
Code:
D:\JPSoft\TCC22>:do 7 (Echo ``)
ECHO ist AUS
ECHO ist AUS
ECHO ist AUS
ECHO ist AUS
ECHO ist AUS
ECHO ist AUS
ECHO ist AUS

D:\JPSoft\TCC22>:for /L %var In (1,1,7) Echo ``








D:\JPSoft\TCC22>: