How to? redirect a bunch of loop

Nov 8, 2015
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 ??
 
May 20, 2008
10,618
81
Syracuse, NY, USA
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
 
Nov 8, 2015
27
1
I'll try it and do with trial and error.. Thanks so much and God bless you.. aameen
 

samintz

Scott Mintz
May 20, 2008
1,420
13
Solon, OH, USA
This may work also. It's basically the same command:
Code:
do i=1 to 3 > reddo.txt
I have not tried it though.
 

rps

Jul 6, 2008
426
5
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.