0

I have one exe file in special folder in my PC. My folder is: D:\Program Files (x86)\FXDD - MetaTrader My exe name: metalang.exe This exe compile files and make with new format. My sample file is for example: vfc.mq4

When want execute this exe, from Command Prompt(cmd) I call that same below: D:\Program Files (x86)\FXDD - MetaTrader\metalang.exe vfc.mq4 and it compile file for me.

Question is here: How do this process in C#? I know this function works for call exe:

Process.Start("C:\\");

I dont know how call vfc.mq4 and what must be format?

Regards;

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
user1955534
  • 53
  • 1
  • 6
  • Look at [MSDN](http://msdn.microsoft.com/en-us/library/0w4h05yb.aspx) for your answer. You can use `ProcessStartInfo` to pass in command line parameters – Matt Burland Sep 04 '13 at 17:11

2 Answers2

1

If you read the documentation, you'll see the Process.Start() can take two parameters – one for the filename of the EXE and one for the command-line arguments.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
  • I do same this: string str1 = "D:\\Program Files (x86)\\FXDD - MetaTrader\\metalang.exe"; string str2 = "D:\\Program Files (x86)\\FXDD - MetaTrader\\VFX.mq4"; Process.Start(str1, str2); But not works. Format must be different? – user1955534 Sep 04 '13 at 17:22
0

Use this:

var process = Process.Start(pathToProgram, argsString);

process.WaitForExit();

var exitCode = process.ExitCode;

on argsString use the path to "vfc.mq4".

Hope it helps!

Font: run console application in C# with parameters

Community
  • 1
  • 1
Marciano.Andrade
  • 307
  • 7
  • 19
  • Have you tried Ken White comment? - http://stackoverflow.com/questions/17321289/use-process-start-with-parameters-and-spaces-in-path – Marciano.Andrade Sep 04 '13 at 18:48