batch-file – Calling functions from another batch file

Lets have the following file called library.cmd :

@echo off

echo -/-/- Batch Functions Library -/-/-

:function1
    echo argument1 - %1
    goto :eof

To execute only the :function1 without the code of the rest of the file you should put a label :function1 in the caller bat and use it like this:

@echo off

call :function1 ###
exit /b %errorlevel%

:function1
    library.bat %*

the output will be (the code outside the function in library.cmd is not executed):

argument1 – ###

For more info check this.

if you want to reproduce, please indicate the source:
batch-file – Calling functions from another batch file - CodeDay