#189396 - 2008-09-03 05:10 PM
Anyone Know how to capture XCOPY errorlevel from a SHELL ?
|
MACE
Starting to like KiXtart
Registered: 2004-09-07
Posts: 150
Loc: Manchester UK
|
I frequently use XCOPY or ROBOCOPY to move batches of files and folders complete with Attributes /K and ACL's /O If I get an error code within the shell,eg a file could not copy of not found, KIX still reports OK when the shell terminates.
Does anyone know a means of passing the cmd errorlevel codes back to the script ?
$CMD='XCOPY "'+$fm+'" "'+$to+'" /c/e/q/g/h/r/k/o/v/y'
shell $CMD
IF @error = 0
RD $fm /s
IF @error <>0 and exist($fm)
$=DebugIt("Failed to RD:"+$fm+"="+@SERROR)
Endif
; Other Stuff
Else
;Take Action
Endif
Edited by MACE (2008-09-03 05:15 PM)
|
|
Top
|
|
|
|
#189491 - 2008-09-05 10:42 PM
Re: Anyone Know how to capture XCOPY errorlevel from a SHELL ?
[Re: MACE]
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4563
Loc: USA
|
At least in this test it works as I would expect.
break on
shell 'xcopy c:\winders\*.* c:\temp'
? "Kixtart reports: " + @serror
Returns: Kixtart reports: The system cannot open the file.
|
|
Top
|
|
|
|
#189499 - 2008-09-06 03:54 PM
Re: Anyone Know how to capture XCOPY errorlevel from a SHELL ?
[Re: NTDOC]
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
It maybe a little late to join the party..
But, this is pretty cool and may have been already talked about. Robocopy is very powerful and has extensive documentation.
The Robocopy GUI from Microsoft takes you step-by-step through the process.
http://technet.microsoft.com/en-us/magazine/cc160891.aspx
I also understand that you guys are trying to make Robo/X copy to work via KiX.
HTH,
Kent
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 820 anonymous users online.
|
|
|