MATLAB: Is the execution of the batch file stopped after running the MCC command on Windows in MATLAB Compiler 4.16 (R2011b)

MATLAB Compiler

I have a small batch script which invoked the MCC command to compile my MATLAB functions. After that I run some further commands, but they aren't executed. My file batch file looks like this
echo Start compiling
mcc -m test.m -v
echo Compiling done
pause
The compiling works fine. But the last lines aren’t reached. The batch file is aborted after the MCC call.

Best Answer

When MCC is invoked from batch file or from system prompt, it invokes mcc.bat as opposed to mcc.exe(from MATLAB). You can verify by checking "where mcc" on your system prompt, you will see it gets from mcc.bat.
So in that case, there is a batch file calling another batch file when MCC is called like in the example. Usually when batch file calls another batch file directly like in the example, they don't handle back the control to the called batch file. Thus one will see the behavior we observed. In that case, one can use CALL on the BATCH file one is calling inside the batch file. For example, the example code can be changed like below and one will observe changes:
echo Start compiling
call mcc -m test.m -v
echo Compiling done
pause