Create Files from a List of File Names

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
 
B

Bob I

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
 
A

Ayush

[[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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top