Passing additional arguments to process
I have this piece of code:
string name = "mark";
string strCmdText2 = @"/C app\bin\tekstar --config test.txt";
System.Diagnostics.Process.Start("CMD.exe", strCmdText2);
when it executes, there is a command prompt and it's waiting for a text to be entered like this:
Enter username:
So the question is: How can I pass the string name to that command prompt? What's the complete co开发者_StackOverflow社区de so that the program will automatically pass the string to the prompt?
You need to set the RedirectStandardIn property in ProcessStartInfo to true.
You can then send input to the program by writing to the In property of the resulting Process object.
加载中,请稍侯......
精彩评论