If the last command fails pause won’t work.
You can fix it by putting “call” behind the command you are running (whatever command is before the pause) then the pause will work.
So for example I had a phpunit batch file that looked like this:
phpunit tests/sometests.php
pause
When phpunit failed it just exited without pausing. Changing it to this made it pause correctly:
call phpunit tests/sometests.php
pause