1 --------- Testing GOTO ---------
3 --------- Testing CALL within batch ---------
4 Test CALL ok from :test_call
5 GOTO with escape caret worked
12 --------- Testing :EOF support ---------
18 --------- Testing GOTO within block ---------
19 Block-test 1: Single-line
20 Block-test 2: Multi-line
21 --------- Testing CALL within block ---------
22 Block-test 3: CALL in block
23 Test CALL in block OK from :test_call_block
26 --------- Testing CALL within FOR ---------
29 Out of FOR 1 CALL from :out_of_loop_1, number is 2
32 --------- Testing GOTO within FOR ---------
35 Out of FOR 2, number is 2
36 --------- Testing FOR loop stopping with GOTO ---------
39 @pwd@>for %A in (1 2 3 4 5 6 7 8 9 10) do (
40 set Number=%A@space@@space@
41 if %A == 5 goto :out_of_loop_2a@space@
45 set Number=1@space@@space@
46 if 1 == 5 goto :out_of_loop_2a@space@
50 set Number=2@space@@space@
51 if 2 == 5 goto :out_of_loop_2a@space@
55 set Number=3@space@@space@
56 if 3 == 5 goto :out_of_loop_2a@space@
60 set Number=4@space@@space@
61 if 4 == 5 goto :out_of_loop_2a@space@
65 set Number=5@space@@space@
66 if 5 == 5 goto :out_of_loop_2a@space@
69 @pwd@>echo Out of FOR 2a, number is 5@space@
70 Out of FOR 2a, number is 5
73 @pwd@\foobar>for /R %A in (1 2 3 4 5 6 7 8 9 10) do (
74 set Number=%~nA@space@@space@
75 if %~nA == 5 goto :out_of_loop_2b@space@
79 set Number=1@space@@space@
80 if 1 == 5 goto :out_of_loop_2b@space@
84 set Number=2@space@@space@
85 if 2 == 5 goto :out_of_loop_2b@space@
89 set Number=3@space@@space@
90 if 3 == 5 goto :out_of_loop_2b@space@
94 set Number=4@space@@space@
95 if 4 == 5 goto :out_of_loop_2b@space@
99 set Number=5@space@@space@
100 if 5 == 5 goto :out_of_loop_2b@space@
103 @pwd@\foobar>echo Out of FOR 2b, number is 5@space@
104 Out of FOR 2b, number is 5
107 @pwd@>for /L %A in (1 1 10) do (
108 set Number=%A@space@@space@
109 if %A == 5 goto :out_of_loop_2c@space@
113 set Number=1@space@@space@
114 if 1 == 5 goto :out_of_loop_2c@space@
118 set Number=2@space@@space@
119 if 2 == 5 goto :out_of_loop_2c@space@
123 set Number=3@space@@space@
124 if 3 == 5 goto :out_of_loop_2c@space@
128 set Number=4@space@@space@
129 if 4 == 5 goto :out_of_loop_2c@space@
133 set Number=5@space@@space@
134 if 5 == 5 goto :out_of_loop_2c@space@
138 set Number=6@space@@space@
139 if 6 == 5 goto :out_of_loop_2c@space@
143 set Number=7@space@@space@
144 if 7 == 5 goto :out_of_loop_2c@space@
148 set Number=8@space@@space@
149 if 8 == 5 goto :out_of_loop_2c@space@
153 set Number=9@space@@space@
154 if 9 == 5 goto :out_of_loop_2c@space@
158 set Number=10@space@@space@
159 if 10 == 5 goto :out_of_loop_2c@space@
162 @pwd@>echo Out of FOR 2c, number is 5@space@
163 Out of FOR 2c, number is 5
166 @pwd@>for %T in ("1:2:3" "4:5:6:7" "8:9:10") do (
167 set "pc=%~T"@space@@space@
168 for /F "delims=" %A in ("!pc::=
170 set Number=%A@space@@space@
171 if %A == 5 goto :out_of_loop_2d@space@
176 set "pc=1:2:3"@space@@space@
177 for /F "delims=" %A in ("!pc::=
179 set Number=%A@space@@space@
180 if %A == 5 goto :out_of_loop_2d@space@
185 set Number=1@space@@space@
186 if 1 == 5 goto :out_of_loop_2d@space@
190 set Number=2@space@@space@
191 if 2 == 5 goto :out_of_loop_2d@space@
195 set Number=3@space@@space@
196 if 3 == 5 goto :out_of_loop_2d@space@
200 set "pc=4:5:6:7"@space@@space@
201 for /F "delims=" %A in ("!pc::=
203 set Number=%A@space@@space@
204 if %A == 5 goto :out_of_loop_2d@space@
209 set Number=4@space@@space@
210 if 4 == 5 goto :out_of_loop_2d@space@
214 set Number=5@space@@space@
215 if 5 == 5 goto :out_of_loop_2d@space@
218 @pwd@>echo Out of FOR 2d, number is 5@space@
219 Out of FOR 2d, number is 5
220 --------- Testing CALL within IF ---------
221 Out of IF CALL from :out_of_if_1, number is 123
223 --------- Testing GOTO within IF ---------
228 --------- Testing EXIT within IF ---------
231 --------- Finished --------------