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
nevesswodniw

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
Pedroc1999

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
UsernameIssues

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:
BAT file to copy file to multiple locations?-batch-error.png

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
Pedroc1999

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
nevesswodniw

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
UsernameIssues

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




Similar help and support threads
Thread Forum
search multiple files, copy+paste to new folder (batch file software?)
I am a complete newbie when it comes to batch files and batch file software, so apologies in advance. I've done some research on Google etc but I seem to just be getting more and more confused trying to use various different scripts and programs and reading different info on various websites. ...
General Discussion
Batch File .bat to copy file from File Sharing & FTP Hosting
Hi all, Any idea how to write Batch File .bat to copy file from File Sharing & FTP Hosting to local directory. Current the File Sharing & FTP Hosting is SMARTFILE. I don't want to use WINSCP as the connector. Thanks
General Discussion
Copy file address after doing a file search in windows explorer
Hi All I have a rather large file system with lots of folders & subfolders. When I want to save previously on Xp operating system I'd search in explorer open the folder I want then copy the address (e.g c:\customer records\client name\job address). In windows 7, when I copy the folder address i...
General Discussion
how do I copy a BIG single file (using richcopy?) big file copy
I'm trying to copy a VHD (22g, dynamic I think...) I tried richcopy. It says copy started, but then stops.... I saw someone mention xcopy /j, to achieve the unbuffered I/O perf. you get with richcopy... it's running, but no indication as to how long it takes (EDIT: just finished, > 10...
General Discussion
Update (copy) file to multiple places in directory structure
I have a directory structure root 1 sida 0002-A.xlp 2 sida 0002-A.xlp ...
General Discussion


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 17:01.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App