Reputation: 4007
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?
Upvotes: 0
Views: 490
Reputation: 10124
Everyone's right about just needing to concatenate. Just a stylistic thing but you can use String.Join to make passing the arguments a bit more elegant:
string[] argv = {"01", user_email, email};
ProcessStartInfo procInfo = new ProcessStartInfo(@"C:\a\a.exe");
procInfo.CreateNoWindow = true;
procInfo.Arguments = String.Join(" ", argv);
Process.Start(procInfo);
Upvotes: 1
Reputation: 17691
try this ..
procInfo.Arguments = "01 " + user_number + " " + email;
Upvotes: 1
Reputation: 1717
Concatenate your arguments into a single string that a delimited by a space? Or you could use some sort of identifier before each argument and have the .exe application parse the string.
Upvotes: 0
Reputation: 723388
You'll want to pass a single string of space-separated arguments:
procInfo.Arguments = "01 " + user_number + " " + email;
The same thing, using a format:
procInfo.Arguments = string.Format("{0} {1} {2}", "01", user_number, email);
Upvotes: 6