My function needs the first file name from a specific directory to handle some tests using the first file, when the tests end, delete the first file from the directory
I tried as below
FOR /R \\<My Folder> %F in (*.zip*) do echo ~nF >%test_list% set /p firstline=%test_list% echo %firstline% FOR /F "tokens=*" %%A IN ('dir %test_firmware_dir% /b/s ^| find /c ".zip"') DO SET count=%%A echo %count% :test_execution if %count% NEQ 0 ( echo ON dir /b %test_firmware_dir%\*.zip >%test_firmware_list% set /p firstline=<%test_firmware_list% set /a filename=%firstline:~0,-4% Echo %filename% Echo ********************************************************* Echo "Now running batch queue tests with %filename%" Echo ********************************************************
it shows the last element of any procedure to get the first element
source share