@echo off
rem *** DEFINE WORKFILE AND STARTING LINE NUMBER ***
set LINE=1
set LST=list.tmp
ls > %LST%

rem *** FILL FILE LIST ***
:LOOP
    rem *** GET NEXT LINE ****
    getlines %LINE% %LINE% %LST% > name.tmp
    if errorlevel 1 goto END

    rem *** MAKE EXTRACTED FILENAME AN ENV VARIABLE ******
    call setenv "NAME=@name.tmp"

    rem *** THIS IS JUST FOR INFORMATION AND CAN BE REMOVED ***
    echo %LST% LINE %LINE% = %NAME%

    rem ****** YOUR PROGRAM/BATCH HERE *******************

    rem ****** COMPUTE NEXT LINE NUMBER ***
    call setenv "LINE=`expr $LINE + 1`"
    goto LOOP

:END
del name.tmp

