Download MetaTrader 5

Unable to run batch file from Metatrader

To add comments, please log in or register
GregorAnton
29
GregorAnton  

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", cmd.com, etc.  same error 2.

Has anyone come across this? 

whroeder1
14781
whroeder1  
  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
254
Cristiano Konrad  
.
To add comments, please log in or register