.bat transfer parameter call by reference to another .bat

  bash, cmd, windows

I have a question about windows batch.
I have two batch files/scripts, the first one calls the second one, several times with different parameters.

I want to create several variables in the first one and pass them as more parameters to the second one.
In this batch-script passed variable should be incremented by one value.
Then the variable is passed again on the next call and should be returned again by a corresponding value.

first .bat script:

::Modules find
set anz_Modules=0
::Modules build successful
set SR_Modules=0
set CPP_Modules=0

call ./Pearl_p2cpp.bat EXTRA auto anz_Modules SR_Modules CPP_Modules
.
.
.
call ./Pearl_p2cpp.bat FKT auto anz_Modules SR_Modules CPP_Modules

second.bat script "Pearl_p2cpp.bat":

::Globale Variablen aus *_ALLES.bat bearbeiten
if NOT[%3]==[] goto noParams
set /a "%~3=%3%+%numberOfModuls%"

if NOT[%4]==[] goto noParams
set /a "%~4=%4%+%SRecordSuccess%"

if NOT[%5]==[] goto noParams
set /a "%~5=%5%+%CppSuccess%"

:noParams

first .bat script again:

echo Es wurden insgesammt [%anz_Modules%]*.P (PEARL)-Module gefunden
echo aus diesen wurden [%SR_Modules%]-SREC und [%CPP_Modules%]-C++ Dateien in %TookTime:~0,-2%.%TookTime:~-2% seconds gebuildet! 

Output:

Es wurden insgesammt [0]*.P (PEARL)-Module gefunden aus diesen wurden
[0]-SREC und [0]-C++ Dateien in 143.41 seconds gebuildet!

Increasing, or editing the variables does not seem to work, what is the problem?

Source: Windows Questions

LEAVE A COMMENT