@echo off for /f "delims=" %%a in (DOSNET.INF) do ( echo/%%a|findstr /xic:"[files]" >nul && ( (echo/%%a echo d1,a.exe echo d1,b.exe echo d1,c.exe)>>newfile.txt )||(echo/%%a>>newfile.txt) ) copy /y newfile.txt DOSNET.INF >nul && del newfile.txt