Created
December 12, 2012 16:23
-
-
Save syl20bnr/4269229 to your computer and use it in GitHub Desktop.
robocopy exit codes suck :-)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rem ------------------------------------------------------------------------------- | |
rem this file controls the error level returned by the tool robocopy in order to | |
rem be usable in a custom build step of Visual Studio | |
rem ------------------------------------------------------------------------------- | |
robocopy.exe /A-:R /NP /NJH /NJS /NDL /NFL /NS /NC %* | |
rem if errorlevel 16 echo Robocopy Exit Status: ***FATAL ERROR*** & exit /b 1 | |
rem if errorlevel 15 echo Robocopy Exit Status: FAIL MISM XTRA COPY & exit /b 1 | |
rem if errorlevel 14 echo Robocopy Exit Status: FAIL MISM XTRA & exit /b 1 | |
rem if errorlevel 13 echo Robocopy Exit Status: FAIL MISM COPY & exit /b 1 | |
rem if errorlevel 12 echo Robocopy Exit Status: FAIL MISM & exit /b 1 | |
rem if errorlevel 11 echo Robocopy Exit Status: FAIL XTRA COPY & exit /b 1 | |
rem if errorlevel 10 echo Robocopy Exit Status: FAIL XTRA & exit /b 1 | |
rem if errorlevel 9 echo Robocopy Exit Status: FAIL COPY & exit /b 1 | |
rem if errorlevel 8 echo Robocopy Exit Status: FAIL & exit /b 1 | |
rem if errorlevel 7 echo Robocopy Exit Status: MISM XTRA COPY OK & exit /b 0 | |
rem if errorlevel 6 echo Robocopy Exit Status: MISM XTRA OK & exit /b 0 | |
rem if errorlevel 5 echo Robocopy Exit Status: MISM COPY OK & exit /b 0 | |
rem if errorlevel 4 echo Robocopy Exit Status: MISM OK & exit /b 0 | |
rem if errorlevel 3 echo Robocopy Exit Status: XTRA COPY OK & exit /b 0 | |
rem if errorlevel 2 echo Robocopy Exit Status: XTRA OK & exit /b 0 | |
rem if errorlevel 1 echo Robocopy Exit Status: COPY OK & exit /b 0 | |
rem if errorlevel 0 echo Robocopy Exit Status: --no change-- & exit /b 0 | |
if errorlevel 16 exit /b 1 | |
if errorlevel 15 exit /b 1 | |
if errorlevel 14 exit /b 1 | |
if errorlevel 13 exit /b 1 | |
if errorlevel 12 exit /b 1 | |
if errorlevel 11 exit /b 1 | |
if errorlevel 10 exit /b 1 | |
if errorlevel 9 exit /b 1 | |
if errorlevel 8 exit /b 1 | |
if errorlevel 7 exit /b 0 | |
if errorlevel 6 exit /b 0 | |
if errorlevel 5 exit /b 0 | |
if errorlevel 4 exit /b 0 | |
if errorlevel 3 exit /b 0 | |
if errorlevel 2 exit /b 0 | |
if errorlevel 1 exit /b 0 | |
if errorlevel 0 exit /b 0 |
if errorlevel geq 8 exit /b 1
is wrong. Use:
if errorlevel 8 exit /b 1
exit /b 0
or
if %errorlevel% geq 8 exit /b 1
exit /b 0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rem Simpli.fy!
if errorlevel geq 8 exit /b 1
exit /b 0