I thout about seperating code between files and use them as functions.
I had many errors until I realized that the Output of this Funcs must be only the 'ECHO ...' that I need.
In these file there must be @ECHO OFF in its 1st line, otherwise each line code become an Output.
Here is a little example. even recursive:
Let's have file Named Func.CMD
We call it from Command-Line with a parameter:
CALL Func.CMD 1
The code in Func.CMD:
@ECHO OFF
SET /A X = %1 + 1
IF %X% LSS 10 FOR /F "DELIMS=" %%i IN ('CALL Func.CMD %X%') DO SET /A X = %%i
ECHO %X%
It looks so:
C:\>CALL Func.CMD 1
10
I hope someone can enjoy it
Yossi