Welcome!

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

SignUp Now!

DO /P ... is this possible ... ?

May
13,000
174
Is it possible to wrap a command like
Code:
do i=1 to 5 ( echo %i )
in DO /P?
 
Hmm. This doesn't work either:
Code:
echo %@execstr[do i=1 to 5 (echos ` `%i)]
 6 6 6 6 6
 
Hmm. This doesn't work either:
Code:
echo %@execstr[do i=1 to 5 (echos ` `%i)]
 6 6 6 6 6
I've seen that one before! :-)
Code:
v:\> do z in /p (do i=1 to 5 ( echos ` `%i )) (echo %z)
 6 6 6 6 6
 
Hmmm! Putting the /P command in parens does work (in other cases).
Code:
v:\ipreg\country> do line in /p (echo foo^r^nbar) (echo %_do_loop %line)
1 foo
2 bar
 
So I guess the answer tp my original question is "yes". And getting it to work is a matter of doubling up some %s.
Code:
v:\ipreg\country> do x in /p ( do i=1 to 3 ( echo %%@eval[%%i**2]) ) ( echo %x foo )
1 foo
4 foo
9 foo

The same goes for Scott's example.
Code:
v:\ipreg\country> echo %@execstr[do i=1 to 5 (echos ` `%%i)]
 1 2 3 4 5

This is what I wanted to do in the first place. And it works!
Code:
v:\ipreg\country> do line in /p (do l in /p grep RU ipcountry.txt (echo %%@eval[0x%%@word[1,%%l]-0x%%@word[0,%%l]+1])) (set /a /q RUSUM+=%line)

v:\ipreg\country> echo %rusum
45162496
 

Similar threads

D
Replies
0
Views
3K
drrob1
D
Back
Top