@ECHO OFF &SETLOCAL :: Read in files for /f tokens^=*^ delims^=^ eol^= %%x in (filelist.txt) do ( set "exclude[%%x]=true" rem echo exclude[%%x] ) for /d %%d in ("cores\*") do ( for %%f in ("ROMS\%%~nd\*") do ( if not defined exclude[%%f] ( echo %%f | findstr /i "\.bin" > nul rem echo %%~nf set "TRUE=" if errorlevel 1 ( if %%~nd neq outrun ( if %%~nf neq prboom ( set TRUE=1 ) ) else ( if %%~nf equ CannonBall ( set TRUE=1 ) ) ) if defined TRUE ( echo %%~nd;%%~nxf.gba copy /y nul "ROMS\%%~nd;%%~nxf.gba" >NUL ) ) ) ) pause