Batch mode for macros is run from the command line using the -batch option:
% starccm+ -batch cavity.java
This will run STAR-CCM+ with a script (cavity.java in the above example). The -batch option ensures that no GUI will be displayed. If you do not want the server process to exit once the batch file has completed (maybe you want to connect to it to analyze results) then add the -noexit option to the command line.