0

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?

4 Answers 4

6

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);
Sign up to request clarification or add additional context in comments.

Comments

1

try this ..

procInfo.Arguments = "01 " + user_number + " " + email; 

Comments

1

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);

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.