Windows – the easiest way to reset ERRORLEVEL to zero

batch-filecmderrorlevelwindows

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?

Best Answer

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