Skip to content

Instantly share code, notes, and snippets.

@jmd
Created January 6, 2017 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmd/b103a121ec035cf889eb604b29d8a535 to your computer and use it in GitHub Desktop.
Save jmd/b103a121ec035cf889eb604b29d8a535 to your computer and use it in GitHub Desktop.
Robocopy wrapper fixing return code issue
REM ============================================================
REM Wrapper for robocopy fixing the exit code issue
REM
REM Robocopy can return a non zero exit code even when there is
REM no error which can be problematic when integrated in a build
REM tool chain.
REM
REM Brocopy addresses that issue by calling robocopy but
REM returning 0 when successfull and 1 otherwise.
REM ============================================================
robocopy %*
REM Exit with 1 when errorlevel >= 8 and 0 otherwise
if ERRORLEVEL 8 GOTO error
exit /B 0
error:
exit /B 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment