» DOS Xtreme Delusions: A Legend In My Own Mind

Trying to modify a collection of files and directories can be time consuming. Here is a batch file that will do the work for you. Specify the path and/or files (this examples specifies all files and directories in the current location) and change the called function to do the specified work. Will even handle spaces in the file or directory names.

More »

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
@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