- May
- 13,834
- 211
This is mostly a question and maybe a feature request.
Below, the first DO was interrupted; the second was not. After the second DO, _DO_LOOP has the value from the interrupted DO. How does that happen?
Feature request: Could _DO_LOOP, outside any DO loops, be made to always have the vaule from the last (outermost) DO loop (successfully completed or aborted)? That would allow the construct below without having to introduce a counter.
For example, in the first code block above, the second _DO_LOOP would be 10.
Below, the first DO was interrupted; the second was not. After the second DO, _DO_LOOP has the value from the interrupted DO. How does that happen?
Code:
v:\> do i=1 to 1000000000 ( echo. > nul )
^C
v:\> echo %_do_loop
5943
v:\> do i=1 to 10 ( echo. > nul )
v:\> echo %_do_loop
5943
Feature request: Could _DO_LOOP, outside any DO loops, be made to always have the vaule from the last (outermost) DO loop (successfully completed or aborted)? That would allow the construct below without having to introduce a counter.
Code:
DO ...
::anything in here
ENDDO
:: check %_DO_LOOP from the outermost DO
IF %_DO_LOOP ...
For example, in the first code block above, the second _DO_LOOP would be 10.