Batch file & XCopy

Klingon

New member
Local time
9:47 AM
Messages
3
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 Computer

OS
XP
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 Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Toshiba Laptop Qosimo X870
OS
Windows 7 Pro x64 SP1
CPU
Intel Core I7
Motherboard
Toshiba Qosmio
Memory
16 Gigs
Graphics Card(s)
NVIDIA GeForce GTX 670M
Monitor(s) Displays
17.7" laptop
Screen Resolution
1600 x 900
Hard Drives
256 Gig SanDisk SSD for C
256 Gig Intel SSD for D
Internet Speed
50/25 FIOS
Antivirus
Vipre (all you can eat for 10 machines)
Browser
IE and FF
Other Info
I have dos 6.22, wfwg 3.11, win98, 2000 and xp VHD's available for testing. MS's Virtual PC works great.
(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 Computer

OS
XP
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 Computer

Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
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 Computer

OS
XP
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 Computer

Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self Built
OS
Windows 7 Ultimate 64bit
CPU
AMD Phenom Quad core 9950 black edition
Motherboard
Gigabyte
Memory
16Gb
Graphics Card(s)
2x XFX Radeon 5850
Sound Card
PCI Express X-Fi Titanium / Logitech G35
Monitor(s) Displays
2x HP 2410i
Screen Resolution
1920x1080
Hard Drives
2x 500Gb Seagate
1x 300Gb Seagate
1x 1Tb Seagate
2x 1Tb Hitatchi
PSU
Jean Tech Storm 700W
Case
Cooler Master COSMOS S
Cooling
Akasa Evo Blue Pro
Keyboard
Logitech G15
Mouse
Mad Catz M.M.O. 7
Internet Speed
12mb
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 Computer

Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
Back
Top