Download MetaTrader 5
To add comments, please log in or register
Interested in traders' opinion? Arrange a poll on the Forum!
GregorAnton 2015.04.19 11:08 

I am able to run a batch file from the command prompt just fine  BUT when I try and run from Metatrader I get Error 2 Code.

MQL4 Script:

#import "shell32.dll"

int ShellExecuteA(int hWnd, string Verb, string File, string Parameter, string Path, int ShowCommand);

#import int r=ShellExecuteA(0, "Open", "C:\Users\Administrator\Tools\send.bat", "", "", 1);

if (r <= 32){ Alert("Shell failed: ", r); return(false); } 


Like I said, running the .bat file or using command prompt, just fine. MQL4 Script does not.  I have tried various variations of the above, like "Run" instead of "Open",, etc.  same error 2.

Has anyone come across this? 

whroeder1 2015.04.19 11:36  
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2.  int r=ShellExecuteA(0, "Open"
    Since February 3, 2014 (Build 600) All strings are Unicode.
  3. ForexTaurus: Has anyone come across this? 
    Six days ago: Unable to run batch file - MQL4 forum
Cristiano Konrad
Cristiano Konrad 2015.05.12 19:26  
To add comments, please log in or register