Process one file at a time in batch [duplicate]

I'm trying to hand over one file at a time to File2BMP, move the output, delete the source and move on to the next file.

I've tried FORFILES but it seems to process all files at once, that's what I want to avoid due to space limitations.

This is what I'm looking at right now:

MKDIR temp

:CONVERT
IF EXIST *7z* (
    FORFILES /M *7z* /c "cmd /c File2BMP.exe @file" | "cmd /c move *.bmp /temp/" | "cmd /c del @file"
    )
    ELSE (
    EXIT
    )
GOTO CONVERT

Any help would be greatly appreciated!


Use a for loop:

@echo off
mkdir Temp>nul 2>&1
for %%i in (*7z*) do (
    File2BMP.exe "%%~i"
    del /Q "%%~i"
)
move *.bmp .\temp

Note though, I moved the move command to outside of the loop to complete that in a batch when the conversions are all done, you can do with that what you like though, just makes more sense to me.