I'm using ShellExecuteW from shell32.dll:
int value= ShellExecuteW(0, "open", "C:\test.bat", strParameters, "", 1);
The batch file runs a java app which seems to open but returns an error and quickly the console window closes.
I want to capture the error from the console. I've tried adding the following re-directions at the end of my command in the batch file:
> output.txt
2> output.txt
> output.txt 2>&1
1> output.txt 2>&1
| output.txt
I would expect these common commands to work but none of them result in anything being written in output.txt. What could I be doing wrong here?
I'm using Metatrader5 (MQL5 language) to call shellexecuteW from.
Thankyou for your replies.
First you should put the bat file in Terminal path in "File" folder because of mql5 security policy, Secondly put these codes in your script to use "ShellExecuteW" function correctly.