Windows 7 Forums


Windows 7: How to make a multible copy batch file

30 May 2011   #1
AGB

Windows 7 Home Premium 64 bit
 
 
How to make a multible copy batch file

Below is a batch file I created to copy all the files from a program called A5V5. This batch file works to copy the files to two different drives What I want to do is if the J: Directory is not availble (This is a flash drive) that it will copy to the E:\ directory which is a second HDD and not leave a "The system cannot find the drive specified" when the flash drive is not inserted.

@echo off
cd c:\
cd program files (x86)
cd A5V5
cd Ranch Mobile, Inc
Copy *.* "E:\Ranch Mobile" (This is a second hard drive for backup files only)
Copy *.* "J:\Ranch Mobile" (This is a Flash drive that is not always inserted)
Pause

Thanks for any help. I like the way batch files work and I can do these simple ones but when it comes to doing the more complicated ones I am at a total loss.

My System SpecsSystem Spec

30 May 2011   #2

Windows 7 Pro SP1 64-bit
England, Cheshire
 
 

Hi AGB,

Welcome to Seven Forums.

Can you try the following and see if this works:
Code:
@echo off
cd "c:\program files (x86)\A5V5\Ranch Mobile, Inc"

Copy *.* "E:\Ranch Mobile"

IF EXIST J:\ (goto jdrive) ELSE (goto end)

:jdrive
Copy *.* "J:\Ranch Mobile"

:end
Pause
This will always copy to your fixed E:\ drive and will only copy to your J:\ drive when exists.
Is this what you wanted?

Regards,
JDobbsy1987
My System SpecsSystem Spec
30 May 2011   #3
AGB

Windows 7 Home Premium 64 bit
 
 

Thanks For very fast response. It works Just fine. I put a pause after the first copy command under the E:/ drive line to see it work with or without the flash drive.
Never being on a forum before I figured since Batch files are rarely mentioned anymore that it would be a few days if at all for a response.
My System SpecsSystem Spec
.


30 May 2011   #4

Windows 7 Pro SP1 64-bit
England, Cheshire
 
 

I'm glad i could be of help.

If the J:\ drive doesn't exist then it will just skip it and move on so you shouldn't see any errors
I use batch files all the time

If you need any more help don't hesitate to post back here, Seven Forums is a wonderful place

Regards,
JDobbsy1987
My System SpecsSystem Spec
Reply

 How to make a multible copy batch file problems?



Thread Tools



Similar help and support threads for: How to make a multible copy batch file
Thread Forum
Solved Creating Batch File with Robo Copy General Discussion
batch file to copy from virtual machine to USB Virtualization
Make GPO changes from a batch file? System Security
Solved Can you tell me what I need to make this batch file run? General Discussion
cant make a batch file:) General Discussion


All times are GMT -5. The time now is 04:05 AM.


Seven Forums Android App Seven Forums IOS App Follow us on Facebook

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
  

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