ouch.

Do you know the call batch instruction, which lets you execute another batch file and then continue the current where you left? Like
Code:
dir /a /o
call some.bat
cd \
Functions work just like that, only that they also have parameters and a return value (you can pass information to them and get information back).