@echo off&setlocal EnableDelayedExpansion
set n=
for /f "tokens=*" %%i in ('dir /b *.cmd *.bat') do set n=!n! %%i
echo %n%

for /f "tokens=1,2 delims= "  %%i in ("%n%") do (
echo %%i %%j
call :fun %%i %%j
goto exit
)

:fun
echo =======
echo %1
echo %2

:exit