What is the easiest way to reset ERRORLEVEL to zero?

user95319 picture user95319 · Jul 11, 2009 · Viewed 77.8k times · Source

I have a post-build event that runs some commands for a c# project. The last command would sometimes cause the ERRORLEVEL value not equals to zero and then the build fails.

I want to append an extra line of command to always set the ERRORLEVEL value to zero. What is the most convenient way to do that?

Answer

akf picture akf · Jul 11, 2009

if you use exit /b 0 you can return an errorlevel 0 from within a child batch script without also exiting the parent.