call :FunctionX
rem More code...
:FunctionX
rem Some code here.
goto :eof
This is a very simple function.
Functions are in-program commands that do multiple commands at a time.
Functions are made by creating a label and putting code in it, and once it is done, you add a goto :eof or exit /b <ErrorlevelYou'dLike> which returns to where it was invoked.
Functions are invoked with call :functionname adparams.