Posted By

shortstack on 03/02/10


Tagged

copy batch


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

Tyster
thastyle
bug5


Batch Copy Files


 / Published in: DOS Batch
 

Script makes a copy of "file.doc" as many times as you need it to. It renames them all with a time-based file name.

Source and destination directories and file names/extensions can be modified easily.

  1. @echo off
  2. setLocal EnableDelayedExpansion
  3.  
  4. set /p X=How many copies do you want? (Note: File to be copied must exist at C:\)
  5. :loop
  6. set /a N+=1
  7. if !N! gtr !X! goto :eof
  8. copy "C:\file.doc" "C:\%time:~,2%%time:~3,2%%time:~6,2%%time:~9,2%.doc"
  9. goto :loop

Report this snippet  

You need to login to post a comment.