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 ?
 Code:
      $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)