Call a subroutine in a batch from another batch file

the file with subroutines must look like:

@echo off
call :%*
exit /b %errorlevel%

:hello
echo in hello
exit /b 0
:Demo
 echo in Demo with argument %1
 exit /b 0

then from the other file you can call it like

call file2.bat demo "arg-one"

Leave a Comment