It doesn’t make any sense to generate text files and then folders to move the files to. Create the folders first place and create the files into the folders. Using a (code block) only one for loop is needed.
@echo off
setlocal
for /f "tokens=*" %%a in (comps.txt) do (
if not exist "%%a" mkdir "%%a"
echo This is line 1 of text>"%%a\%%a.txt"
)
endlocal
1
solved How to create folders and files from text file with same names to insert with corresponding name?