Functions with Parameters
Batch Script Functions can work with parameters by simply passing them when a call is made to the function.
Call :function_name parameter1, parameter2… parameternThe parameters can then be accessed from within the function by using the tilde (~) character along with the positional number of the parameter.
Example
The following example shows how a function with parameters can be called.
@echo off
SETLOCAL
CALL :Display 5 , 10
EXIT /B %ERRORLEVEL%
:Display
echo The value of parameter 1 is %~1
echo The value of parameter 2 is %~2
EXIT /B 0The value of parameter 1 is 5
The value of parameter 2 is 10