Gah! The one thing that always gets me with working with so many different programming langauges (C#, T-SQL, Perl, VB, DOS) is that they each tend to refer to the same thing with a slightly different name. (If you read Perl: same foo, different bar).

Today when stepping out of T-SQL land and into DOS, I had a little trouble trying to track down the return codes exit codes for the windows XCOPY tool. In case you’ve had the same problem here are the:

Exit codes for xcopy, Return codes for xcopy, and %errorlevel% for xcopy

The following table lists each exit code for xcopy and a description.

Exit code Description
0 Files were copied without error.
1 No files were found to copy.
2 The user pressed CTRL+C to terminate xcopy.
4 Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line.
5 Disk write error occurred.

See the MSDN Documentation.