Return to Snippet

Revision: 46130
at May 13, 2011 06:24 by pollusb


Initial Code
@echo off
FOR /F "tokens=*" %%F in ('dir *.txt /b') do FOR /F "tokens=*" %%L in (%%F) do echo %%F,%%L >> CombinedFile.txt

Initial URL

                                

Initial Description
This code will simply add the filename in front of each line for all files that match *.txt. This way, you can combine a large number of CSV files into 1 file by using a pipe redirect.

Initial Title
How to use 2 FOR loop in a batch dos command

Initial Tags

                                

Initial Language
DOS Batch