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: 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 8.1 Pro x64
 
 

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 8.1 Pro x64
 
 

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




Thread Tools



Similar help and support threads for2: How to make a multible copy batch file
Thread Forum
Batch file to copy files from C drive to USB Backup and Restore
Windows7 Batch File Copy Possible? Performance & Maintenance
How to copy a file from 1 pc to another pc in network using batch file General Discussion
Solved Creating Batch File with Robo Copy General Discussion
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

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 08:52 PM.
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