开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜