Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: BAT file to copy file to multiple locations?


01 Jan 2013   #1

7 Ult x64 sp1
 
 
BAT file to copy file to multiple locations?

Hi, I have a file with no extension called simply, D:\file

I want to copy this to multiple locations, eg e:\file , f:\file

sometimes there will already be an older version, so I would like it to overwrite the file.


Is this possible with a bat file?


I tried a simple copy command in a bat file, but it wouldn't copy at all.



thanks.

My System SpecsSystem Spec
.

01 Jan 2013   #2

Windows 7 Ultimate x86
 
 

Have you tried 'xcopy' with the /y flag. This should copy the files and overwrite without it prompting you.... Would this suut your needs?
My System SpecsSystem Spec
01 Jan 2013   #3

W7 Pro SP1 64bit
 
 

Quote   Quote: Originally Posted by nevesswodniw View Post
.....I tried a simple copy command in a bat file, but it wouldn't copy at all....
As long as you have access rights (permissions) to copy to the area of interest, then copy should work just fine. Like pedro said, you will want the "/y" switch on the end to handle overwriting any existing file(s).

It is probably best to workout the syntax using the command prompt window or include a pause in your batch file so that you can see any errors that might occur:
Name:  batch-error.png
Views: 15
Size:  8.4 KB

BAT file to copy file to multiple locations?-batch1.png

or with wildcards

BAT file to copy file to multiple locations?-batch2.png


My System SpecsSystem Spec
.


01 Jan 2013   #4

Windows 7 Ultimate x86
 
 

You may find yourself that you would like more "flags" or "switches" which will help refine and customize the xcopy command- here is whee i learned xcopy switches from

http://ss64.com/nt/xcopy.html
My System SpecsSystem Spec
05 Jan 2013   #5

7 Ult x64 sp1
 
 

Thanks guys, You helped me with the pause command

It said cannot find file, so had to use xcopy /h because it is hidden, wouldnt have figured it out without pause.


Thanks again!
My System SpecsSystem Spec
05 Jan 2013   #6

W7 Pro SP1 64bit
 
 

thx for posting back.
glad it is working for you now.
My System SpecsSystem Spec
Reply

 BAT file to copy file to multiple locations?




Thread Tools




Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 12:00 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33