all.txt file is the file that has the lines needs to be extracted,
c_list.txt is the files that contain the file's names in every line one name
Code: Select all
@echo off
cls
setlocal enabledelayedexpansion
set c=0
For /F "tokens=*" %%a in (all.txt) Do (
set /a c=c+1
set line=%%a
For /F "tokens=*" %%b in (c_list.txt) do (
echo !line!>>%%b.txt
)
)
so the first line from all.txt echo to a file named with the first name in the c_list.txt
and the 2nd line echo to a file named with the name of the 2nd name in the c_list and so is the rest of the lines
lines in all.txt files is equal to lines in the c_list.txt
each line in all.txt has a name in the c_list.txt file.