how can I get the name of a function.
like this:
Code: Select all
:theFunction
echo the name of the function is ???
goto:eof
thanks in advance, pumi
Moderator: DosItHelp
Code: Select all
:theFunction
echo the name of the function is ???
goto:eof
Code: Select all
@echo off
call :theFunction
goto:eof
:theFunction
echo the name of the function is %0
goto:eof
Code: Select all
@echo off
call :theFunction
pause
goto:eof
:theFunction
set func=%0
echo the name of the function is %func:~1%
goto:eof
Code: Select all
@echo off
call :theFunction
pause
goto:eof
:theFunction
echo the name of the function is %0 %~pnx0
goto:eof
Code: Select all
@echo off
call :theFunction
echo theFunction
goto:eof
:theFunction
set func=%0
echo the name of the function is %func:~1%
set "%func:~1%=the result"
goto:eof
Code: Select all
@echo off &setlocal
call :theFunction
echo back in main: %func%
pause
goto:eof
:theFunction
set "func=%0"
set "func=%func:~1%"
echo the name of the function is %func%
goto:eof
You have just missed the %'s:pumi wrote:Unfortunately this does not work in this way.
Code: Select all
@echo off
call :theFunction
echo %theFunction%
goto:eof
:theFunction
set func=%0
echo the name of the function is %func:~1%
set "%func:~1%=the result"
goto:eof