Windows Batch Script - File iteration issue -
id read input many files 1 @ time , process input before going next file. files have special name defines order of input. follows: ordersheet_a_b_d. though following code in batch file allow me read them in order specified loops, doesn't anything. can maybe see mistake? have following in .bat file:
@echo off %%a in (20, 40, 80) ( %%b in (80, 160) ( /l %%c in (1,1,3) ( /l %%d in (1,1,10) ( /l %%e in (1,1,6) ( /l %%f in (0,1,6) ( if %%e lss %%f ( if exist ordersheet_%%a_%%b_%%d echo " " %%e %%f >> output.txt if exist ordersheet_%%a_%%b_%%d start thesisvelo.exe distancematrix_%%a.txt ordersheet_%%a_%%b_%%d %%c %%d %%e %%f >> output.txt ) ) ) ) ) ) )
the batch file below achieve same process of original code, have minor modifications made code clearer , show names of processed files. please, note don't know code supposed achieve!
@echo off setlocal enabledelayedexpansion %%a in (20 40 80) ( %%b in (80 160) ( /l %%c in (1,1,3) ( /l %%d in (1,1,10) ( /l %%e in (1,1,6) ( rem process values of %%f greater %%e set /a f=%%e+1 /l %%f in (!f!,1,6) ( echo ordersheet_%%a_%%b_%%d c=%%c, d=%%d, e=%%e, f=%%f if exist ordersheet_%%a_%%b_%%d ( echo " " %%e %%f >> output.txt start thesisvelo.exe distancematrix_%%a.txt ordersheet_%%a_%%b_%%d %%c %%d %%e %%f >> output.txt ) ) ) ) ) ) )
some segments of output:
ordersheet_20_80_1 c=1, d=1, e=1, f=2 ordersheet_20_80_1 c=1, d=1, e=1, f=3 ordersheet_20_80_1 c=1, d=1, e=1, f=4 ordersheet_20_80_1 c=1, d=1, e=1, f=5 ordersheet_20_80_1 c=1, d=1, e=1, f=6 ordersheet_20_80_1 c=1, d=1, e=2, f=3 ordersheet_20_80_1 c=1, d=1, e=2, f=4 ordersheet_20_80_1 c=1, d=1, e=2, f=5 ordersheet_20_80_1 c=1, d=1, e=2, f=6 ordersheet_20_80_1 c=1, d=1, e=3, f=4 ordersheet_20_80_1 c=1, d=1, e=3, f=5 ordersheet_20_80_1 c=1, d=1, e=3, f=6 ordersheet_20_80_1 c=1, d=1, e=4, f=5 ordersheet_20_80_1 c=1, d=1, e=4, f=6 ordersheet_20_80_1 c=1, d=1, e=5, f=6 ordersheet_20_80_2 c=1, d=2, e=1, f=2 . . . ordersheet_20_80_2 c=1, d=2, e=5, f=6 ordersheet_20_80_3 c=1, d=3, e=1, f=2 . . . ordersheet_20_80_3 c=1, d=3, e=5, f=6 ordersheet_20_80_4 c=1, d=4, e=1, f=2 . . . ordersheet_20_80_4 c=1, d=4, e=5, f=6 ordersheet_20_80_5 c=1, d=5, e=1, f=2 . . . ordersheet_20_80_5 c=1, d=5, e=5, f=6 ordersheet_20_80_6 c=1, d=6, e=1, f=2 . . . ordersheet_20_80_6 c=1, d=6, e=5, f=6 ordersheet_20_80_7 c=1, d=7, e=1, f=2 . . . ordersheet_20_80_7 c=1, d=7, e=5, f=6 ordersheet_20_80_8 c=1, d=8, e=1, f=2 . . . ordersheet_20_80_8 c=1, d=8, e=5, f=6 ordersheet_20_80_9 c=1, d=9, e=1, f=2 . . . ordersheet_20_80_9 c=1, d=9, e=5, f=6 ordersheet_20_80_10 c=1, d=10, e=1, f=2 . . . ordersheet_20_80_10 c=1, d=10, e=5, f=6 same block above c=2 , c=3 until: ordersheet_20_80_10 c=3, d=10, e=5, f=6 same whole block above, from: ordersheet_20_160_1 c=1, d=1, e=1, f=2 until: ordersheet_20_160_10 c=3, d=10, e=5, f=6 same whole block above, from: ordersheet_40_80_1 c=1, d=1, e=1, f=2 until: ordersheet_40_160_10 c=3, d=10, e=5, f=6 same, from: ordersheet_80_80_1 c=1, d=1, e=1, f=2 until: ordersheet_80_160_10 c=3, d=10, e=5, f=6
Comments
Post a Comment