Create Files from a List of File Names

  • Thread starter Thread starter melissa_4011
  • Start date Start date
M

melissa_4011

Hi,

I'm working with batch files and I am trying to create single separate
text files from a list of names that I have. For example, let's say I
have a text file (or CSV, etc) with the names:

red
orange
blue

I want the batch file to output a new file named red.txt; a new file
named orange.txt; and a new file named blue.txt

Is this possible?

Any input would be appreciated.

Thanks
 
You would need some thing to put in the file.
create a text file that you will use for the base then


Copy base.txt red.txt
Copy base.txt orange.txt
Copy base.txt blue.txt
 
[[email protected]]s message :
Hi,

I'm working with batch files and I am trying to create single separate
text files from a list of names that I have. For example, let's say I
have a text file (or CSV, etc) with the names:

red
orange
blue

I want the batch file to output a new file named red.txt; a new file
named orange.txt; and a new file named blue.txt

try this:
for /f "tokens=*" %%l in (x.txt) do @type nul > "%%l.txt"

warning: this will overwrite any existing files with same name!


Good Luck, Ayush.
 
Back
Top