A frequent method to handling errors within Windows batch scripts is to use things like  

`if errorlevel 1 ...` or `if %errorlevel% neq 0 ...`. Often times one wants the error handling code to preserve the ERRORLEVEL.

I believe all external commands will always result in ERRORLEVEL being set to some value, so the error handling code must preserve the ERRORLEVEL in an environment variable prior to executing an external command.

But what about internal commands? The problem is, some internal commands clear the ERRORLEVEL to 0 when they succeed, and some do not. And I can't find any documentation specifying which commands do what.

So the question is, **which internal commands clear the ERRORLEVEL to 0 upon success?** This is ***not*** a general question about returned ERRORLEVEL codes, but strictly about success results.

There are posts like [What is the easiest way to reset ERRORLEVEL to zero?](https://stackoverflow.com/q/1113727/1012053) and [Windows batch files: .bat vs .cmd?](https://stackoverflow.com/q/148968/1012053) that give partial answers. But I have never seen a comprehensive list.

***Note:*** *I've been curious about this for years. So I finally decided to run a bunch of experiments and come up with a definitive answer. I'm posting this Q&A to share what I have found.*