@echo off set TXTFILE=file_listing.h set DIRPATH="KingsBounty/*" set DIRNAME=KingsBounty set INDEX=0 ::Create TXTFILE echo //FIle listing generated by BAT script > "%TXTFILE%" ::List files in DIRPATH and call function to write ::files into TXTFILE FOR %%i IN (%DIRPATH%) DO Call :Function_Write %%i echo %TXTFILE% created from files in directory %DIRPATH% GoTo :EOF :Function_Write echo #define FILE_NAME_%INDEX% "%DIRNAME%/%1\0" >> "%TXTFILE%" echo dword file%INDEX% = FROM FILE_NAME_%INDEX%; >> "%TXTFILE%" if %INDEX%==10 set INDEX=11 if %INDEX%==9 set INDEX=10 if %INDEX%==8 set INDEX=9 if %INDEX%==7 set INDEX=8 if %INDEX%==6 set INDEX=7 if %INDEX%==5 set INDEX=6 if %INDEX%==4 set INDEX=5 if %INDEX%==3 set INDEX=4 if %INDEX%==2 set INDEX=3 if %INDEX%==1 set INDEX=2 if %INDEX%==0 set INDEX=1