Cmd fails to restore window title after nested batch file
Normally when you run a batch file or other program from the command prompt the title of the console window changes to include the name of the batch file while it's running, such as "Command Prompt - testbatch".
But after it runs the following batch file (testbatch.bat which chains to testbatch2.bat) it never changes it back, even though it has run to completion. So if you run it three times you end up with "Command Prompt - testbatch - testbatch - testbatch" as the title.
To reproduce, create the following two files and run "testbatch" from the command prompt multiple times.
if errorlevel 0 (
Glen Knowles commented
As a workaround, you can use a goto to jump around the body of the if block instead of putting it inside paranthesis.
if errorlevel 0 goto next