0

Ok guys, I got this far:

        ProcessStartInfo procInfo = new ProcessStartInfo(@"C:\a\a.exe");
        procInfo.CreateNoWindow = true;
        procInfo.Arguments = "01";
        procInfo.Arguments = user_number;
        procInfo.Arguments = email;
        Process.Start(procInfo);

But it only passes one argument (being the last one to overwrite), how do i pass more then one argument, the args on the console is an array, this must mean i can pass more then one argument?

David
  • 3,927
  • 6
  • 30
  • 48

6 Answers6

1

something like

ProcessStartInfo procInfo = new ProcessStartInfo(@"C:\a\a.exe");
procInfo.CreateNoWindow = true;

List<string> arguments = new List<string>();
arguments.Add("01");
arguments.Add(user_number);
arguments.Add(email);

procInfo.Arguments = string.Join(" ", arguments);
Process.Start(procInfo);
Kralizek
  • 1,999
  • 1
  • 28
  • 47
0
Process.Start(@"C:\1\a.exe", "myargument");

Or if the argument needs to contain a space:

Process.Start(@"C:\1\a.exe", "\"my argument contains a space\"");

Please see the Process.Start method's MSDN article.

Connell
  • 13,925
  • 11
  • 59
  • 92
0

You'll have to pass in a ProcessStartInfo object. You can add arguments to the Arguments property.

Jan Jongboom
  • 26,598
  • 9
  • 83
  • 120
0

to use Process.Start and pass arguments you could follow the example here: process.start() arguments

to manipulate the arguments from your console or windows forms application just check the content of the args array passed to the Main method as parameter

Community
  • 1
  • 1
Davide Piras
  • 43,984
  • 10
  • 98
  • 147
0

Probably, like this also using the Arguments.

        ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
        startInfo.WindowStyle = ProcessWindowStyle.Minimized;

        Process.Start(startInfo);

        startInfo.Arguments = "www.northwindtraders.com";

        Process.Start(startInfo);
0

Can u please make yourself clear?

If you intend to pass params use the following code ...

ProcessStartInfo procInfo = new ProcessStartInfo();
procInfo.FileNmae = "example.exe"
procInfo.Arguments = "param1"
Process.Start(procInfo)
Connell
  • 13,925
  • 11
  • 59
  • 92