You can start CATIA and request that a macro is executed as soon as CATIA is started using the -macro option followed by the full path of the macro you want to run:
CNEXT -macro P:\Users\MyMacros\MacroToRun.CATScript
For example, this macro would run the CATMain function defined in the MacroToRun.CATScript file.
Macros can however be stored in other macro libraries like catvba documents or any other V5 documents like CATPart or CATProduct documents. You can use the following syntax to run the CATMain function defined in the myMacro macro of the myDocument document:
CNEXT -macro myDocument.catvbamyMacro
CNEXT -macro myDocument.CATPartmyMacro
CATIA sessions launched this way will remain active after the end of the macro unless you explicitly end it in the macro using the CATIA.Quit method.
Common paths for CNEXT.exe are C:|Program Files|Dassault Systemes|B17|intel_a|code|bin|CNEXT.exe