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: Batch file & XCopy

24 Apr 2011   #1
Klingon

XP
 
 
Batch file & XCopy

I hope this is the correct forum??

I have a small network with 2 XPs and 1 Win7. The Win 7 PC recently replaced on older XP PC. I have been backing up accounting data from one XP to another XP using a DOS batch file that uses the XCopy command and this has been working fine for several years. An accounting package that resides on the Win 7 PC can access the data on the XP with no problem.

I moved the batch file to the Win7 PC and it fails with "Invalid drive specification".

The data on the XP PC that needs to be copied resides in "c:\accounting\quickbooks" and "c:\accounting\peachtree". On the Win7 PC the "c:\accounting" is mapped as "Z".

If I use the DOS prompt I can do a "Dir Z:\" and it works. I can also run the same xcopy command from the batch file at the DOS prompt and it works fine.

The one xcopy command is:
XCOPY Z:\QuickBooks\*.* c:\Data\Zipped\QuickBooks\ /E /V /C /H /R /Y

Why does the batch file fail??? For some reason it can't "see" the "Z" drive. I also want to run the batch file nightly as a scheduled task.

Thanks


My System SpecsSystem Spec
.
24 Apr 2011   #2
richnrockville

Windows 7 Pro x64 SP1
 
 

Quote   Quote: Originally Posted by Klingon View Post
I hope this is the correct forum??

I moved the batch file to the Win7 PC and it fails with "Invalid drive specification".

The data on the XP PC that needs to be copied resides in "c:\accounting\quickbooks" and "c:\accounting\peachtree". On the Win7 PC the "c:\accounting" is mapped as "Z".

If I use the DOS prompt I can do a "Dir Z:\" and it works. I can also run the same xcopy command from the batch file at the DOS prompt and it works fine.

The one xcopy command is:
XCOPY Z:\QuickBooks\*.* c:\Data\Zipped\QuickBooks\ /E /V /C /H /R /Y

Why does the batch file fail??? For some reason it can't "see" the "Z" drive. I also want to run the batch file nightly as a scheduled task.

Thanks
have you tried the batch files from the cmd prompt?

can you type dir z:\quickbooks

On some versions of quickbooks there is a space in the name, if so then you have to enclose the two parts of the xcopy in " marks.
ie
XCOPY "Z:\Quick Books\*.*" "c:\Data\Zipped\Quick Books\" /E /V /C /H /R /Y

Rich
My System SpecsSystem Spec
24 Apr 2011   #3
Klingon

XP
 
 

(1) There are no spaces in the directory names.
(2) I can run the batch file from the "C" prompt and it does copy files.
(3) I can do dir z:\quickbooks from the "C" prompt.

The way I run the batch file to test it is:
(1) Open explorer
(2) Right click on the batch file
(3) Run as administrator
(4) The batch file runs but I get the "invalid drive specification"

If I change the XCOPY to copy from c:\... to c:\... on the Win7 PC the batch file runs OK. It just won't copy from a mapped networked drive to "C".
My System SpecsSystem Spec
.

24 Apr 2011   #4
MilesAhead

Windows 7 32 bit
 
 

Seems to be a common problem with nobody really nailing down the cause. This link seemed the most helpful:

xcopy between networked computers? - Windows-XP-General-Discussion - Windows-XP

The post with stuff about 'z' for computer name was the most interesting. I don't use xcopy enough to know the switches. An alternative may be RichCopy. If you google you can download free from MS. I'm not sure how good it is in batch files, but it copied my Windows.old, over 200,000 files, over a network without waiting a year to start the file copy. Didn't crap out either.
My System SpecsSystem Spec
25 Apr 2011   #5
Klingon

XP
 
 

I finally solved this! Mapping the directory as "Z" works fine on XP using XCopy in a bath file but does NOT work on Win7.

For some reason, on Win 7, I have to use the UNC convention of the machine name of the XP I want to copy data from which is DJNTY391.

The following works in XP but NOT Win7 where "Z:\Accounting" is a mapped network drive:
xcopy Z:\QuickBooks\*.* c:\Data\..\QuickBooks\ /E /V /C /H /R /Y

This works in Win 7:
xcopy \\djnty391\accounting\quickbooks\*.* c:\data\..\quickbooks\ /e /v /h /r /y

Applications can access the mapped drive but the batch file can not! Strange????
My System SpecsSystem Spec
25 Apr 2011   #6
MilesAhead

Windows 7 32 bit
 
 

Yeah, that was one of the suggestions in the threads I found, use the UNC name. But it doesn't always work. Looks like it's one of those quirks you can only fix by trial and error.

I wish they would settle on some home networking conventions and leave them alone once they work. XP to Vista to W7 it's like it's changed every time and you have to fight new battles for little gain.
My System SpecsSystem Spec
25 Apr 2011   #7
PooMan UK

Windows 7 Ultimate 64bit
 
 

Maybe have a looky here Freeware Xcopy util
My System SpecsSystem Spec
25 Apr 2011   #8
MilesAhead

Windows 7 32 bit
 
 

The OP can run XCopy as it is, except from a batch file. There's some quirk in the way the command processor is interpreting mapped drives or command line params when embedded in batch. That's the issue.
My System SpecsSystem Spec
Reply

 Batch file & XCopy




Thread Tools




Similar help and support threads
Thread Forum
Xcopy File Not Found Error
I'm trying to copy my reg back ups to override my current registry. I am doing this in the boot disk cmd. It is telling me File Not Found - RegBack even though I clearly have a folder called it that I am changing my directory to. cd \windows\system32\config\regback xcopy...
Backup and Restore
How to run a batch file at logoff & some batch scripting help please
Hiya, I'd just like to run a simple batch file at logoff to backup some settings. I plan to use Robocopy, which is what i use to more thorough backups. Two questions: 1. How make it run by clicking Start > Shutdown? (i realise i could make a shutdown batch file and run it instead, but i'd...
Backup and Restore
xcopy comes up with 'file not found'
I am just trying to get this simple script i wrote to work in a batch file, but when I run the file, in the cmd screen, it comes up with; File not found- Backup 0 file(s) copied This is the script I use; @Echo Off xcopy /s "c:\Users\Jacob Smith\Desktop\Server\world d:\Users\Jacob...
General Discussion
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
Created a scheduled .bat file to xcopy. How do I?
I've created a bat file to run on a schedule to backup stuff. How do I make the taskeng.exe gui not appear?
Customization
Help with bat file (xcopy) on Win7
I have a batch file that copies some files from a win7 hard drive to a USB stick. Sample code: mkdir G:\holder xcopy C:\users\me\documents\sub\*.*/s/e/h/r/y/D G:\holder\*.* This file works fine on any previous version of MS Windows to copy all the files in the targeted directory that are...
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 09:44.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App