Welcome!

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

SignUp Now!

How to? redirect a bunch of loop

Nov
27
1
How one can redirect the whole do loop process in once in batch scrip, not in a line with command separator character and does not use iterated redirection i.e. using '>>' within loop body.

do i=1 to 9
echo Page %i
enddo

... then how to redirect it to text file e.g ' >a ' once for all output above ??
 
This seems to work. I don't know how robust it is.
Code:
v:\> type reddo.btm
> reddo.txt do i=1 to 3
echo %i
enddo

v:\> reddo.btm

v:\> type reddo.txt
1
2
3
 
This may work also. It's basically the same command:
Code:
do i=1 to 3 > reddo.txt
I have not tried it though.
 
This may work also. It's basically the same command:
Code:
do i=1 to 3 > reddo.txt
I have not tried it though.
This works for me.
Code:
C:\JPSoft>(do i=1 to 3 (echo %i))
1
2
3
C:\JPSoft>(do i=1 to 3 (echo %i)) >! reddo.txt
C:\JPSoft>type reddo.txt
1
2
3
Here it is as a simple btm:
Code:
C:\JPSoft>type reddo.btm
: reddo.btm
do i=1 to 3
echo %i
enddo
C:\JPSoft>reddo.btm >! reddo.txt
C:\JPSoft>type reddo.txt
1
2
3
The >! just over rights any existing reddo.txt.
 

Similar threads

Back
Top