PDA

View Full Version : Xcopy (All)



Burke
06-14-2002, 12:50 PM
We currently used xcopy to copy updated software to our terminal servers. The command we use is

xcopy \\%origin\OneWorld\Prodb733 \\%Destination\OneWorld\Prodb733 /h /s /e .

The problem we are running into is if someone is in the application we are updating, which is very rare, we get a "sharing violation" error. Xcopy does not have an error code for this so there is not way to check for it. I'm trying to build in some error checking. Is there any way to encapsulate the command in WSH and have it catch this error or is there a way to do this within WSH?

gdellasala
06-16-2002, 11:03 AM
The exit code for a failed xcopy is 5. Also, you may want to add the /d option (nothing else needed) so that only newer source files are copied to the destination, the /c option so that one failure doesn't kill the whole copy operation, and if you want, the /y option to automatically overwrite target files. For full information on xcopy, go to:

http://www.microsoft.com/technet/treeview/default.asp?url=/TechNet/prodtechnol/winxppro/proddocs/xcopy.asp


Jerry

Burke
06-19-2002, 02:06 PM
Errorlevel 5 did not work but errorlevel 4 did. Thanks for the direction.