How to use loops in command files, How to use loops in command files -4 – Gasboy CFN III Manager Manual V3.6 User Manual
Page 216

[P:]* TYPE TEST2.CMD
↵
if -y Are you sure?
BEGIN
pr da
pr pu
END
else
BEGIN
echo Not sure.
if -y Are you really REALLY not sure?
BEGIN
echo Definitely not sure.
exit
END
else
echo Not sure if not sure.
END
[P:]* TEST2
↵
Are you sure? y
↵
pr da
Sat 9/18/99 11:40AM, Trans=57, Seq=624 SCIIIv3.3
pr pu
P# T# Pr Pc Price
Totals
$Total
Rate
Limit Slow
1 1 1 1 0.799
178.770
181.10
100/$
$30
0.500
2 2 2 0.859
360.716
322.74
3 3 3 0.919
740.360
741.94
2 1 1 1 0.799
84.110
66.44
100/$
$30
0.500
3 2 3 0.919
2.140
3.13
3 3 3 0.919
462.540
494.42
3 3 3 3 0.919
353.044
357.14
100/$
$30
0.500
4 4 4 4 1.069
336.634
349.97
100/$
$30
0.500
5 1 1 1 0.799
7019.954
6722.35
100/G
$500
0.500
6 2 2 2 0.859
503.411
548.22
100/G
$30
0.500
7 3 3 3 0.919
464.840
578.71
100/G
$30
0.500
8 4 4 4 1.069
778.470
804.44
100/G
$30
0.500
========
=======
11284.99 11170.60
[P:]* TEST2
↵
Are you sure? n
↵
Not sure.
Are you really REALLY not sure? y
↵
Definitely not sure.
[P:]*
Advanced Command Files
How to Use the IF Command
Page 20-4 MDE-4871 CFN III Manager’s Manual for Windows® XP Embedded - Version 3.6 · August 2010
The following example is for demonstration purposes. It does not do anything useful.
How to Use Loops in Command Files
Two commands, LOOP and RETURN, support looping in command files. When the command
LOOP is executed, the current position in the command file is recorded. If the command
RETURN is executed, processing will resume at the location where the last LOOP was found.
If a RETURN is executed and there was no LOOP, the command file is restarted. To get out of
a loop, use IF to skip over the RETURN.
Note: You cannot perform “nested” loops.
The three forms of LOOP-RETURN are:
• do . . . while
• do . . . until
• while . . . do
The do . . . while form uses an IF with a positive statement and looks like this: