I'm a newbie, I don't really understand how to use goto. I have a small piece of code below. Why does the outer loop only run once?
@echo off
setlocal enabledelayedexpansion
for /L %%i in (1,1,3) do (
echo parent loop no: %%i
set "jump=0"
for /L %%j in (1,1,5) do (
echo child loop no: %%j
if %%j equ 2 (
set "jump=1"
goto :jump_label
)
)
:jump_label
echo test
)
pause
The result I received is as below:
parent loop no: 1
child loop no: 1
child loop no: 2
test
Expect result:
parent loop no: 1
child loop no: 1
child loop no: 2
parent loop no: 2
child loop no: 1
child loop no: 2
parent loop no: 3
child loop no: 1
child loop no: 2
test
Please help!