Visual Studioでビルド後にrobocopyするサンプル

ビルド後に実行するコマンドラインの例

IF $(ConfigurationName)==Debug EXIT 0
robocopy $(TargetDir) $(ProjectDir)..\..\..\..\bin\ $(TargetName).* /s /xf *vshost* *.pdf Thumbs.db old* *old *_old.xlsx *.cache *.tmp /xd obj old* backup /xo /ndl /np
IF %ERRORLEVEL% LSS 8 EXIT 0

robocopyの戻り値はこんな感じらしい
Robocopy Exit Codes | Windows CMD | SS64.com
http://ss64.com/nt/robocopy-exit.html

The return code from Robocopy is a bitmap, defined as follows:
Hex Decimal Meaning if set

0×00 0 No errors occurred, and no copying was done.
The source and destination directory trees are completely synchronized.

0×01 1 One or more files were copied successfully (that is, new files have arrived).

0×02 2 Some Extra files or directories were detected. No files were copied
Examine the output log for details.

0×04 4 Some Mismatched files or directories were detected.
Examine the output log. Housekeeping might be required.

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×10 16 Serious error. Robocopy did not copy any files.
Either a usage error or an error due to insufficient access privileges
on the source or destination directories.

These can be combined, giving a few extra exit codes:
0×03 3 (2+1) Some files were copied. Additional files were present. No failure was encountered.

0×05 5 (4+1) Some files were copied. Some files were mismatched. No failure was encountered.

0×06 6 (4+2) Additional files and mismatched files exist. No files were copied and no failures were encountered.
This means that the files already exist in the destination directory

0×07 7 (4+1+2) Files were copied, a file mismatch was present, and additional files were present.