Megha Hi Friends, The basic issue is "To read stdin and stdout in the same program" The following program is i have wrote using thread but i figured out that stdout is working but it is not working when application need the input. ''myprog.pl'' is the simple perlscript which ask for the your name and print the same. the execution sequence is given below: c:\ myprog.plEnter your name: MynameYour name is: Myname When i am running this script from my C# prog given below it it is not asking for the name at all and it is giving following output; C:\myCSharpProg.exestdinstdoutEnter your name:Your name is : Could anyone please help me on this, it will be veryhelpful to me if any alternative method is there to achieve this. Thanks in Advanced,Megha 展开 | 选择 | Wrap | 行号 推荐答案 你做了很多奇怪的事情。 例如 You do a lot of wierd stuff. For instance 展开 | 选择 | Wrap | 行号 谢谢你的回复。 但是我不能改变cmd.exe。因为我想要所有带扩展名的命令(.msc,.pl,.cpl,.exe等),这些命令可能不是win32应用程序,其中Process类在分配Process.File时无法生成进程。关于\ n我正在照顾。 谢谢, Paresh Thanks for the reply. But i cant change "cmd.exe" because i wants to all the commands with extensions (.msc,.pl,.cpl,.exe etc) which may not be win32 application where Process class failed to spawn process when it assigned Process.File. About "\n" i am taking care. Thanks,Paresh 如果可以使用提供的参数运行CMD,提供的参数将作为进程自行运行。 通过使用带参数的CMD,您实际上只是重新包装应用程序。 它就像是一样你刚刚运行CMD 然后在CMD窗口中键入你的文件名。 唯一不能正常工作的是像dir这样的命令;,cd和其他特定于控制台的命令。If CMD can be run with the arguments provided, the arguments provided will run by themselves as the processes.By using CMD with arguments, you are effectively just re-wrapping the application.It''s the same as if you just ran CMDThen in the CMD window type your filename. The only things that don''t work like that are commands like "dir", "cd" and other console specific commands. 这篇关于无法使用C#Process类运行交互式程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-24 09:12