Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 829903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:57:21+00:00 2026-05-15T03:57:21+00:00

I want to make a .bat to copy & rename a file multiple times.

  • 0

I want to make a .bat to copy & rename a file multiple times. I want to have a list of names, and an original file, then I want to copy that file and rename it for each name on the list.

How I can do this using a .bat file?

Also is it possible to run winrar fromthe .bat to .rar or .zip every file after copying/renaming?

Example:

$file = "file.tmpl";
$names = "name1, name2, name3, nameetc";
foreach( $names as $name) {
    copy $file; //to avoid deleting the original
    rename $file to $name;
    zip $name; //I dont really need this but if its easy to do i will like to use it
}

So I start with a file.tmpl and I end up with 4 more files (which are a duplicate of file.tmpl) called name1, name2, name3, nameetc.

The example is not a real coding lang, I used a sort of php sintax because is the language I know more.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:57:22+00:00Added an answer on May 15, 2026 at 3:57 am

    Do the file names need to be in a string list?

    If you can name them in a separate file, like so,

    name-one.pdf
    name-two.pdf
    name-three.pdf
    

    then this batch file will work

    SET source_file=%1
    SET name_list_file=%2
    
    FOR /F "usebackq delims=," %%G IN (`TYPE %name_list_file%`) DO (
        COPY %source_file% %%G
    )
    

    You would call it like this

    batch-file-name source-file-name name-list-file
    

    In other words, I called the batch file make-copies.bat, and the name file filenames.txt, and I used it to copy a file called mla-play.pdf.

    make-copies mla-play.pdf filenames.txt
    

    This also allows you to change the target name list without modifying the batch file.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to make .BAT file delete it self after completion? I have a simple
I would like to make a .bat file that would add some string at
I want to make it with a *.bat file, how would I do this?
I have style sheet with a class name changebackgroundcolor i want make change in
I am traversing a HTML document using javascript DOM. I want make a list
I have link for example domain.com/de/controler/action?param=value and I want make actionlink to keep same
I have uploaded a app in production mode to linode. I want make changes
I have a .bat file and in the file something like this d: cd
I have a batch file that automates copying a bunch of files from one
I want to create a bat file to uninstall a program but I cant

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.