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
JDobbsy1987

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
JDobbsy1987

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
Thread Forum
Windows7 Batch File Copy Possible?
Fellow Forum Members, I have two external hard drives I'm calling Hard Drive A and Hard Drive B. Hard Drive A & B are mounted to external USB cradles. Both USB cradles are connected to the same PC containing Hard Drive C. My objective is to transfer all data files, folders, sub folders from both...
Performance & Maintenance
How to copy a file from 1 pc to another pc in network using batch file
Help me make a batch file that copies a file from one computer to another computer in a network... PC1 = Source PC2 = Destination I want to copy a file from PC1's Drive E: to PC2's Drive E:
General Discussion
batch file to copy from virtual machine to USB
If C:\ is the root of the virtual machine and U:\ is the USB stick, I can PERFORM "copy C:\folder\** U:\folder", but that line in a batch file does not work. How can I fix that ?
Virtualization
Make GPO changes from a batch file?
Hi I'm confused and seeking guidance. I physically manage well over 100 systems on a hardware level and very little on a software level. Yet, there are many tiny modification I've install to keep things running for the end users. The only time I actually interact with the system on a...
System Security
Can you tell me what I need to make this batch file run?
I run a batch file to do image backups. It will only run if I am in the built- in-admin account. When I saw the command line option I thought I had it made. Because the batch file runs in C:\windows\system32\cmd I figured I was already at an elevated commandprompt so I merely added 'net user...
General Discussion
cant make a batch file:)
hello i need help making .bat file from .txt Windows 7 wont make it for me when i rename the thing to .bat i just see it as .bat.txt thx
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:23.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App