The answer by Chris is correct. However if it were actually an error, the pause would not stop the cmd shell from just exiting. Here's how I troubleshoot this simply without redirecting output (and having to keep opening the output log file):
Run cmd.exe. Then within the command window, run 'cmd<enter>
' a couple more times. This executes cmd.exe as a child of cmd.exe but within the same command window.
Now call the .bat / .cmd from within the command window, e.g. C:\Temp\mybat.bat
- if it errors it will exit the cmd.exe it was running in and display the error (and any other output) in the window but return processing to the parent cmd.exe process within the same command window. As there is a parent process the batch window will not just close on error.