Robocopy is a great tool for copying files and is built into Vista. As a reference here is some information on the exit codes (not error codes – they provide information about what the program did), from http://kerpau.net/robocopy-exit-codes/
The return code from Robocopy is a bit map, defined as follows:
Hex Bit Value Decimal Value Meaning If Set
0×10 16 Serious error. Robocopy did not copy any files. This is either a usage error or an error due to insufficient access privileges on the source or destination directories.
0×08 8 Some files or directories could not be copied (copy errors occurred and the retry limit was exceeded). Check these errors further.
0×04 4 Some Mismatched files or directories were detected. Examine the output log. Housekeeping is probably necessary.
0×02 2 Some Extra files or directories were detected. Examine the output log. Some housekeeping may be needed.
0×01 1 One or more files were copied successfully (that is, new files have arrived).
0×00 0 No errors occurred, and no copying was done. The source and destination directory trees are completely synchronized.
You might get a code not listed here, like 3. If this is the case, all of the codes that add up to the value you received happened. Exit code 3 indicates that files were copied and that extra directories were detected. This might happen if you’re backing up a folder. I’ll talk about using robocopy for vista backups next time.
[...] If it’s not, check the folders you specified are right and of course you could check the exit code for some more [...]
[...] gives. Generally you should get 0,1,2 or 3 (0×0, 0×1, 0×2, 0×3), but consult Robocopy exit codes if you’re not sure. At times I’ve gotten 16 (0×10) when my external drive [...]