Is there a way to compile MQL4 and/or MQL5 files within command line?

To add comments, please log in or register
Jose Luis Lominchar
272
Jose Luis Lominchar  

Is there a way to compile MQL4 and/or MQL5 files within command line?

kypa
942
kypa  

metaeditor.exe /compile "the mql file"

or something like that

metaeditor64.exe for 64 bit MT5

Anthony Garot
1583
Anthony Garot  
Jose Luis Lominchar:

Is there a way to compile MQL4 and/or MQL5 files within command line?

Here's a simple batch file I use.
@echo off

    set METAEDITOR="C:\Program Files\MetaTrader 5\metaeditor64.exe"
    set "LOGFILE=%~dpn1.log"

    if "%~1"=="" (
        echo "You must specify the first parameter to this batch file."
        goto end
    )

    :: Compile the MQL5 way
    %METAEDITOR% /compile:%1 /log
    :: 0 = failed
    :: 1 = everything good
    echo "Error level %ERRORLEVEL%"

    :: This dumps the log file to stdout so it can be seen.
    :: It's assumed to be in the same directory as the expert file.
    type "%LOGFILE%"

    :: Once shown, get rid of the .log file.
    erase "%LOGFILE%"    

:end
    :: If I want the CMD.exe window to go away, use exit
    ::exit %ERRORLEVEL%
Jose Luis Lominchar
272
Jose Luis Lominchar  
Thank you very much, Anthony. I'll try it.
To add comments, please log in or register