You can create a function to call frequently used code from within a batch file. First make a label and then call it using the Call function.

@ECHO OFF
SETLOCAL

CALL:getHello
ECHO World

GOTO:EOF

:getHello
ECHO Hello

:EOF
ENDLOCAL

The output will look like this.

Hello
World

References:
DosTips.com

Leave a Reply

You must be logged in to post a comment.