1 --------- Testing GOTO ---------
3 --------- Testing CALL within batch ---------
4 Test CALL ok from :test_call
5 --------- Testing :EOF support ---------
11 --------- Testing GOTO within block ---------
12 Block-test 1: Single-line
13 Block-test 2: Multi-line
14 --------- Testing CALL within block ---------
15 Block-test 3: CALL in block
16 Test CALL in block OK from :test_call_block
19 --------- Testing CALL within FOR ---------
22 Out of FOR 1 CALL from :out_of_loop_1, number is 2
25 --------- Testing GOTO within FOR ---------
28 Out of FOR 2, number is 2
29 --------- Testing FOR loop stopping with GOTO ---------
32 @pwd@>for %A in (1 2 3 4 5 6 7 8 9 10) do (
33 set Number=%A@space@@space@
34 if %A == 5 goto :out_of_loop_2a@space@
38 set Number=1@space@@space@
39 if 1 == 5 goto :out_of_loop_2a@space@
43 set Number=2@space@@space@
44 if 2 == 5 goto :out_of_loop_2a@space@
48 set Number=3@space@@space@
49 if 3 == 5 goto :out_of_loop_2a@space@
53 set Number=4@space@@space@
54 if 4 == 5 goto :out_of_loop_2a@space@
58 set Number=5@space@@space@
59 if 5 == 5 goto :out_of_loop_2a@space@
62 @pwd@>echo Out of FOR 2a, number is 5@space@
63 Out of FOR 2a, number is 5
66 @pwd@\foobar>for /R %A in (1 2 3 4 5 6 7 8 9 10) do (
67 set Number=%~nA@space@@space@
68 if %~nA == 5 goto :out_of_loop_2b@space@
72 set Number=1@space@@space@
73 if 1 == 5 goto :out_of_loop_2b@space@
77 set Number=2@space@@space@
78 if 2 == 5 goto :out_of_loop_2b@space@
82 set Number=3@space@@space@
83 if 3 == 5 goto :out_of_loop_2b@space@
87 set Number=4@space@@space@
88 if 4 == 5 goto :out_of_loop_2b@space@
92 set Number=5@space@@space@
93 if 5 == 5 goto :out_of_loop_2b@space@
96 @pwd@\foobar>echo Out of FOR 2b, number is 5@space@
97 Out of FOR 2b, number is 5
100 @pwd@>for /L %A in (1 1 10) do (
101 set Number=%A@space@@space@
102 if %A == 5 goto :out_of_loop_2c@space@
106 set Number=1@space@@space@
107 if 1 == 5 goto :out_of_loop_2c@space@
111 set Number=2@space@@space@
112 if 2 == 5 goto :out_of_loop_2c@space@
116 set Number=3@space@@space@
117 if 3 == 5 goto :out_of_loop_2c@space@
121 set Number=4@space@@space@
122 if 4 == 5 goto :out_of_loop_2c@space@
126 set Number=5@space@@space@
127 if 5 == 5 goto :out_of_loop_2c@space@
131 set Number=6@space@@space@
132 if 6 == 5 goto :out_of_loop_2c@space@
136 set Number=7@space@@space@
137 if 7 == 5 goto :out_of_loop_2c@space@
141 set Number=8@space@@space@
142 if 8 == 5 goto :out_of_loop_2c@space@
146 set Number=9@space@@space@
147 if 9 == 5 goto :out_of_loop_2c@space@
151 set Number=10@space@@space@
152 if 10 == 5 goto :out_of_loop_2c@space@
155 @pwd@>echo Out of FOR 2c, number is 5@space@
156 Out of FOR 2c, number is 5
159 @pwd@>for %T in ("1:2:3" "4:5:6:7" "8:9:10") do (
160 set "pc=%~T"@space@@space@
161 for /F "delims=" %A in ("!pc::=
163 set Number=%A@space@@space@
164 if %A == 5 goto :out_of_loop_2d@space@
169 set "pc=1:2:3"@space@@space@
170 for /F "delims=" %A in ("!pc::=
172 set Number=%A@space@@space@
173 if %A == 5 goto :out_of_loop_2d@space@
178 set Number=1@space@@space@
179 if 1 == 5 goto :out_of_loop_2d@space@
183 set Number=2@space@@space@
184 if 2 == 5 goto :out_of_loop_2d@space@
188 set Number=3@space@@space@
189 if 3 == 5 goto :out_of_loop_2d@space@
193 set "pc=4:5:6:7"@space@@space@
194 for /F "delims=" %A in ("!pc::=
196 set Number=%A@space@@space@
197 if %A == 5 goto :out_of_loop_2d@space@
202 set Number=4@space@@space@
203 if 4 == 5 goto :out_of_loop_2d@space@
207 set Number=5@space@@space@
208 if 5 == 5 goto :out_of_loop_2d@space@
211 @pwd@>echo Out of FOR 2d, number is 5@space@
212 Out of FOR 2d, number is 5
213 --------- Testing CALL within IF ---------
214 Out of IF CALL from :out_of_if_1, number is 123
216 --------- Testing GOTO within IF ---------
221 --------- Testing EXIT within IF ---------
224 --------- Finished --------------