- How do you know? I can't even create a c:\a.txt (access denied [Windows 10.]) Try setting the default directory to your path C:\Users\Xxxx and move a.txt there.
- Syntax for calling AutoIt compiled Script (.exe) using ShellExecuteW in MT4 EA (Quest) - MQL4 forum
- run a *.bat from EA (Route206) - MQL4 forum
- Execute an exe-file from MQL (Steffen Siegert) - MQL4 forum
Use CopyFileW for copying instead. Moreover, unlike ShellExecurte it is synchronous.
Thanks heaps. Here's some working examples of both methods:
#import "shell32.dll" int ShellExecuteW(int hwnd,string Operation,string File,string Parameters,string Directory,int ShowCmd); #import string src_path = TerminalInfoString(TERMINAL_DATA_PATH)+"\\MQL4\\Files\\"; string dst_path = TerminalInfoString(TERMINAL_DATA_PATH)+"\\MQL4\\"; string src_file = "a.txt"; string dst_file = "b.txt"; int file_hndl; file_hndl = FileOpen(src_path+src_file,FILE_WRITE); FileClose(file_hndl); ShellExecuteW (NULL, "open", "cmd", "/c copy /Y "+src_path+src_file+" "+dst_path+dst_file, NULL, NULL);
#import "kernel32.dll" bool CopyFileW(string lpExistingFileName, string lpNewFileName, bool bFailIfExists); #import string src_path = TerminalInfoString(TERMINAL_DATA_PATH)+"\\MQL4\\Files\\"; string dst_path = TerminalInfoString(TERMINAL_DATA_PATH)+"\\MQL4\\"; string src_file = "a.txt"; string dst_file = "b.txt"; int file_hndl; file_hndl = FileOpen(src_path+src_file,FILE_WRITE); FileClose(file_hndl); CopyFileW(src_path+src_file,dst_path+dst_file,false);
I guess the dll will move files within mt4 terminal folder and not outside to other windows folders?
thank you for this fantastic help.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I'm trying to copy a file on my C: drive from mql4. I cannot use the inbuilt mql4 FileCopy command as the file I want to copy is not within the metatrader folders.
Here is my test code, but it's not working. Any help would be much appreciated?