rem 3行毎 set cnt=1 for /f "delims=" %%a in (hoge.txt) do call :sub %%a for /f "tokens=1,2* delims=," %%a in (hogehoge.txt) do echo %%a %%b %%c pause &exit /b :sub if %cnt% LSS 3 ( set LN=%LN%,%1 set /a cnt+=1 exit /b ) >>hogehoge.txt echo %LN%,%1 set LN= set cnt=1