Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Single-line Do-CMD is a bit uncooperative.

Sep
134
1
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 ?
 
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.
 
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
 
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]
^^^
 
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>:
 

Similar threads

Back
Top