My guess is that the OP simply wants to avoid the hassle of maintaining code
in separate files. Your func.bat certainly reduces the number of files
involved, but perhaps he does not know that this could all go in one file
using internal subroutines, i.e.:
@echo off
echo/program to demonstrate internal functions
call:showusername
call:getinput zzz "enter a zzz value: "
echo/you entered [%zzz%]
goto:eof
:showusername
echo/%username%
goto:eof
:getinput
set /p %1=%2
goto:eof
None of these are "functions" in the purest sense, as there is no way to
reference the calls as values, as is the case with C++ and other languages
supporting functions, i.e.:
result = atan(angle)
The ":getinput" routine uses a technique I have found useful, where you
supply the name of the variable you want the result assigned to. This is
more general than hard-coding a variable name in the routine, and then
remembering to use it when the routine is called, as you typically wind up
having more SET commands.
The above simple technique could also be used in a separate function library
file as suggested by Ray at {wherever he is}.
/Al