1--------- Testing GOTO --------- 2Test GOTO ok 3--------- Testing CALL within batch --------- 4Test CALL ok from :test_call 5GOTO with escape caret worked 6Hi there! 7Hi there! 8Hi there! 9Hi there! 10Hi there! 11Hi there! 12--------- Testing :EOF support --------- 13OK 14OK 15OK 16OK 17OK 18--------- Testing GOTO within block --------- 19Block-test 1: Single-line 20Block-test 2: Multi-line 21--------- Testing CALL within block --------- 22Block-test 3: CALL in block 23Test CALL in block OK from :test_call_block 24CALL done 25Block-test 4 OK 26--------- Testing CALL within FOR --------- 270 IS NOT equal to 2 281 IS NOT equal to 2 29Out of FOR 1 CALL from :out_of_loop_1, number is 2 302 IS equal to 2 313 IS NOT equal to 2 32--------- Testing GOTO within FOR --------- 330 IS NOT equal to 2 341 IS NOT equal to 2 35Out of FOR 2, number is 2 36--------- Testing FOR loop stopping with GOTO --------- 37--- FOR 38 39@pwd@>for %A in (1 2 3 4 5 6 7 8 9 10) do ( 40set Number=%A@space@@space@ 41 if %A == 5 goto :out_of_loop_2a@space@ 42)@space@ 43 44@pwd@>( 45set Number=1@space@@space@ 46 if 1 == 5 goto :out_of_loop_2a@space@ 47)@space@ 48 49@pwd@>( 50set Number=2@space@@space@ 51 if 2 == 5 goto :out_of_loop_2a@space@ 52)@space@ 53 54@pwd@>( 55set Number=3@space@@space@ 56 if 3 == 5 goto :out_of_loop_2a@space@ 57)@space@ 58 59@pwd@>( 60set Number=4@space@@space@ 61 if 4 == 5 goto :out_of_loop_2a@space@ 62)@space@ 63 64@pwd@>( 65set Number=5@space@@space@ 66 if 5 == 5 goto :out_of_loop_2a@space@ 67)@space@ 68 69@pwd@>echo Out of FOR 2a, number is 5@space@ 70Out of FOR 2a, number is 5 71--- FOR /R 72 73@pwd@\foobar>for /R %A in (1 2 3 4 5 6 7 8 9 10) do ( 74set Number=%~nA@space@@space@ 75 if %~nA == 5 goto :out_of_loop_2b@space@ 76)@space@ 77 78@pwd@\foobar>( 79set Number=1@space@@space@ 80 if 1 == 5 goto :out_of_loop_2b@space@ 81)@space@ 82 83@pwd@\foobar>( 84set Number=2@space@@space@ 85 if 2 == 5 goto :out_of_loop_2b@space@ 86)@space@ 87 88@pwd@\foobar>( 89set Number=3@space@@space@ 90 if 3 == 5 goto :out_of_loop_2b@space@ 91)@space@ 92 93@pwd@\foobar>( 94set Number=4@space@@space@ 95 if 4 == 5 goto :out_of_loop_2b@space@ 96)@space@ 97 98@pwd@\foobar>( 99set Number=5@space@@space@ 100 if 5 == 5 goto :out_of_loop_2b@space@ 101)@space@ 102 103@pwd@\foobar>echo Out of FOR 2b, number is 5@space@ 104Out of FOR 2b, number is 5 105--- FOR /L 106 107@pwd@>for /L %A in (1 1 10) do ( 108set Number=%A@space@@space@ 109 if %A == 5 goto :out_of_loop_2c@space@ 110)@space@ 111 112@pwd@>( 113set Number=1@space@@space@ 114 if 1 == 5 goto :out_of_loop_2c@space@ 115)@space@ 116 117@pwd@>( 118set Number=2@space@@space@ 119 if 2 == 5 goto :out_of_loop_2c@space@ 120)@space@ 121 122@pwd@>( 123set Number=3@space@@space@ 124 if 3 == 5 goto :out_of_loop_2c@space@ 125)@space@ 126 127@pwd@>( 128set Number=4@space@@space@ 129 if 4 == 5 goto :out_of_loop_2c@space@ 130)@space@ 131 132@pwd@>( 133set Number=5@space@@space@ 134 if 5 == 5 goto :out_of_loop_2c@space@ 135)@space@ 136 137@pwd@>( 138set Number=6@space@@space@ 139 if 6 == 5 goto :out_of_loop_2c@space@ 140)@space@ 141 142@pwd@>( 143set Number=7@space@@space@ 144 if 7 == 5 goto :out_of_loop_2c@space@ 145)@space@ 146 147@pwd@>( 148set Number=8@space@@space@ 149 if 8 == 5 goto :out_of_loop_2c@space@ 150)@space@ 151 152@pwd@>( 153set Number=9@space@@space@ 154 if 9 == 5 goto :out_of_loop_2c@space@ 155)@space@ 156 157@pwd@>( 158set Number=10@space@@space@ 159 if 10 == 5 goto :out_of_loop_2c@space@ 160)@space@ 161 162@pwd@>echo Out of FOR 2c, number is 5@space@ 163Out of FOR 2c, number is 5 164--- FOR /F 165 166@pwd@>for %T in ("1:2:3" "4:5:6:7" "8:9:10") do ( 167set "pc=%~T"@space@@space@ 168 for /F "delims=" %A in ("!pc::= 169!") do ( 170set Number=%A@space@@space@ 171 if %A == 5 goto :out_of_loop_2d@space@ 172)@space@ 173)@space@ 174 175@pwd@>( 176set "pc=1:2:3"@space@@space@ 177 for /F "delims=" %A in ("!pc::= 178!") do ( 179set Number=%A@space@@space@ 180 if %A == 5 goto :out_of_loop_2d@space@ 181)@space@ 182)@space@ 183 184@pwd@>( 185set Number=1@space@@space@ 186 if 1 == 5 goto :out_of_loop_2d@space@ 187)@space@ 188 189@pwd@>( 190set Number=2@space@@space@ 191 if 2 == 5 goto :out_of_loop_2d@space@ 192)@space@ 193 194@pwd@>( 195set Number=3@space@@space@ 196 if 3 == 5 goto :out_of_loop_2d@space@ 197)@space@ 198 199@pwd@>( 200set "pc=4:5:6:7"@space@@space@ 201 for /F "delims=" %A in ("!pc::= 202!") do ( 203set Number=%A@space@@space@ 204 if %A == 5 goto :out_of_loop_2d@space@ 205)@space@ 206)@space@ 207 208@pwd@>( 209set Number=4@space@@space@ 210 if 4 == 5 goto :out_of_loop_2d@space@ 211)@space@ 212 213@pwd@>( 214set Number=5@space@@space@ 215 if 5 == 5 goto :out_of_loop_2d@space@ 216)@space@ 217 218@pwd@>echo Out of FOR 2d, number is 5@space@ 219Out of FOR 2d, number is 5 220--------- Testing CALL within IF --------- 221Out of IF CALL from :out_of_if_1, number is 123 222Success IF echo 1 223--------- Testing GOTO within IF --------- 224Out of IF ok 225A 226A 227B 228--------- Testing EXIT within IF --------- 229First block 230Second block 231--------- Finished -------------- 232