I have written this little script and its behavior is driving me mad.
Shortly stated, it calls the same function several consecutive times... and then starts the.. magic ?
![Laughing :lol:](./images/smilies/icon_lol.gif)
- up to 35 consecutive CALLs, it works as I would expect
- if i add a 36th CALL, then it raises error about missing label. Like The system cannot find the batch label specified...
- if I comment this 36th CALL, then it runs fine... except that some CALLs are ignored, jumped !
- if I add a hundred more consecutive CALLS, then it runs fine. Even too much: I can see several hundreds if not thousands calls to the function, way more than there is in the script.
And moreover, every now and then, I can see the error message about missing label... for this same function. And on next CALL it is back again.
![Laughing :lol:](./images/smilies/icon_lol.gif)
Or maybe I have written a wild special character, that would explain this behavior, but I don't see it.
Is this something already mentioned ? Known limitation ? Bug ?
Find my script below, with the 35 CALLs that works fine. Try to add more, and tell me if you experience the same than me...
I run W11 Enterprise - 23H2 (22631.3737).
Code: Select all
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
SETLOCAL EnableDelayedExpansion
SET "__DBG=OK"
SET "list="
CALL :__add_item 001
CALL :__add_item 002
CALL :__add_item 003
CALL :__add_item 004
CALL :__add_item 005
CALL :__add_item 006
CALL :__add_item 007
CALL :__add_item 008
CALL :__add_item 009
CALL :__add_item 010
CALL :__add_item 011
CALL :__add_item 012
CALL :__add_item 013
CALL :__add_item 014
CALL :__add_item 015
CALL :__add_item 016
CALL :__add_item 017
CALL :__add_item 018
CALL :__add_item 019
CALL :__add_item 020
CALL :__add_item 021
CALL :__add_item 022
CALL :__add_item 023
CALL :__add_item 024
CALL :__add_item 025
CALL :__add_item 026
CALL :__add_item 027
CALL :__add_item 028
CALL :__add_item 029
CALL :__add_item 030
CALL :__add_item 031
CALL :__add_item 032
CALL :__add_item 033
CALL :__add_item 034
CALL :__add_item 035
:loopscan
call :__print_dbg Processing list %list%
for %%i in ( %list% ) do (
call :__print_dbg Reading item %%i
)
TIMEOUT 20 /nobreak
GOTO loopscan
EXIT /B
:__print_dbg
IF DEFINED __DBG echo DEBUG %*
goto :eof
:__add_item
call :__print_dbg Adding item %~1
set "list=%list% %~1"
goto :eof