Referência Ligue
CALL a subroutine (:label)
The CALL command will pass control to the statement after the label specified along with any specified parameters. To exit the subroutine specify GOTO:eof this will transfer control to the end of the current subroutine.
A label is defined by a single colon followed by a name. This is the basis of a batch file function.
CALL :sub_display 123 CALL :sub_display 456 ECHO All Done GOTO :eof :sub_display ECHO The result is %1 GOTO :eof
At the end of the subroutine, GOTO :eof will return to the position where you used CALL.
Command blocks do not work with the call command. Redirection with & | <> also does not work as expected.
Referência Usando parênteses / colchetes para agrupar expressões :
Parenthesis can be used to split commands across multiple lines. This can make code more readable. Variables will be evaluated for the code block just as if the command was a single line.
(command) ( command command )
Example
IF EXIST C:\pagefile.sys ( ECHO pagefile found on C: drive)
If the command will fit on a single line, then the parenthesis can be omitted
Você tem o seguinte bloco de comando dentro do seu bloco de chamada:
(if %mm% LSS 10 set mm=0%mm%)&(if %dd% LSS 10 set dd=0%dd%)
...
A GOTO command inside a bracketed code block will break the parenthesis context and cause errors. A GOTO will also break a For-Do Loop.
Acredito que call
funciona como goto
. Então (
... call...
... )
poderia ser seu problema.
Por que você não transforma OrdinalToDate
em um arquivo de lote separado?