creating new files from a list?

  • Thread starter Thread starter jim.e.dimoni
  • Start date Start date
J

jim.e.dimoni

I have a TEMPLATE.PUB file.

I have a .TXT file with a list of names

I would like to create copies of the template file with the names in
the TXT file as the filename.

Is there a simple way to automate this?

thx
 
I have a TEMPLATE.PUB file.

I have a .TXT file with a list of names

I would like to create copies of the template file with the names in
the TXT file as the filename.

Is there a simple way to automate this?

thx

You could run this command from a Command Prompt:

for /F %a in (Files.txt) do copy /y Template.pub %a

It is possible to further automate the process by embedding
this command in a batch file.
 
THX, works fine.

For my education can u give me a short explanation

/F
%a
/y

and why does Files.txt have to be in parens?

thx again
 
Ok, here we go:

for /F %a in (Files.txt) do copy /y Template.pub %a

the /F switch broadly means that the "for" command
should select something from a file or from a set of
files. Type for /? at the Command Prompt to see a
few examples.

%a is a variable that assumes different values while
the command is looping. Type the following command
to see what I mean:

for %a in (Tom Dick Harry) do @echo My name is %a.

I won't tell you what the /y switch means. Type copy /?
at the Command Prompt to see for yourself!
 

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

Back
Top