|"file" and "path" are not assigned values in the code presented. That's one problem.|
Next, the return-code will be only that of the batch "wrapper", not the individual operations initiated by it. The batchfile itself should handle the error reporting. Simplest method is to pipe error output of xcopy to a logfile:
file.WriteLine "XCOPY " & path & " " & folder & " /SEY 2>>xcerr.log"
but of course your batch could handle it other ways using errorlevel (from inside the batch, not your batch-creation code which is presenting problems anyway.)
message edited by nbrane