Execute an exe-file from MQL

 

Hallo,

Is there a safety method to execute an exe-file from an EA? 

traderdoc 

 
By "safety", do you mean running the antivirus software first?
 

Sorry, no, I mean one method that really works.

How can I run an exe-file from an EA out? 

 

SellExecute:

#import "shell32.dll"
// https://www.mql5.com/en/articles/1467
int ShellExecuteW(int hWnd,int lpVerb,string lpFile,string lpParameters,string lpDirectory,int nCmdShow);
#import
 

ShellExecuteW or ShellExecuteA?

Thank you all.

@WHRoeder: 

 ShellExecuteW(NULL,"open","c:\\users\\route206\\desktop\\test.bat",NULL,NULL,1);

  1. The first argument is an int, use 0 not NULL.
  2. The last two are strings. Try passing empty strings ("") not NULLS.
But the second argument is int, but here with "open" a string?
 
  1. Strings have been Unicode since Build 600 17.02.2014. You must use the W version.
  2. Where do you get that idea?
    HINSTANCE ShellExecute(
      _In_opt_ HWND    hwnd,
      _In_opt_ LPCTSTR lpOperation,
      _In_     LPCTSTR lpFile,
      _In_opt_ LPCTSTR lpParameters,
      _In_opt_ LPCTSTR lpDirectory,
      _In_     INT     nShowCmd
    );
    -- ShellExecute function (Windows)
    
    

Reason: