使用标准输出和输入运行批处理文件 [英] run batch file with Standard Output and Input

查看:81
本文介绍了使用标准输出和输入运行批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




在我的windows应用程序中,我需要执行一个批处理文件。

这个批处理文件会向屏幕抛出一些文字和问题,我需要

捕获标准输出,检查它是否是一个问题,如果它是一个问题,

i想要弹出一个messageBox或者其他东西,然后带上回到批处理文件

结果(是的没有问题)。我知道如何执行批处理文件并在最后得到所有

标准输出,但我不知道我能通过

行和检查它是否是一个问题,如果是,请将结果带回

批处理文件。


有人可以帮我吗?


谢谢,

Gidi。

Hi,

In my windows applicationm, i need to excute a batch file.
this batch file throws some text and questions to the screen, i need to
catch the standard Output, check if it''s a question, in case it''s a question,
i want to popup a messageBox or something, and bring back to the batch file
the result (Yes\No question). I know how to excute the batch file and get all
the Standard output at the end, but i don''t know who can i read it line by
line and check if it''s a question, and in case it is, bring the result to the
batch file back.

can anyone help me here?

Thanks,
Gidi.

推荐答案

2008年3月24日星期一02:56:00-0700,Gidi< sh ***** @ hotmail.com.dontspamwrote:
On Mon, 24 Mar 2008 02:56:00 -0700, Gidi <sh*****@hotmail.com.dontspamwrote:

>
这个批处理文件会向屏幕抛出一些文本和问题,我需要抓住标准输出,检查它是否是一个问题如果这是一个问题,
我想弹出一个messageBox或者其他东西,然后带回批处理文件结果(是的没有问题)。我知道如何执行批处理文件并在最后获得所有标准输出,但我不知道是谁可以通过
行读取它并检查它是否是一个问题,如果是的话,将结果带回
批处理文件。

任何人都可以帮助我吗?
>Hi,

In my windows applicationm, i need to excute a batch file.
this batch file throws some text and questions to the screen, i need to
catch the standard Output, check if it''s a question, in case it''s a question,
i want to popup a messageBox or something, and bring back to the batch file
the result (Yes\No question). I know how to excute the batch file and get all
the Standard output at the end, but i don''t know who can i read it line by
line and check if it''s a question, and in case it is, bring the result to the
batch file back.

can anyone help me here?



嗯,检查此MSDN条目中包含的样本是否有帮助 - 听起来好像

大概就像你打算做的那样...

http: //msdn2.microsoft.com/en-us/lib...treadline.aspx


问候,

Gilles。

Hmm, check if the sample contained in this MSDN entry helps - sounds
approximately like what you intend to do ...

http://msdn2.microsoft.com/en-us/lib...treadline.aspx

Regards,
Gilles.


谢谢,


但我已经读过这篇文章了,它并没有帮助我,因为它''没有

执行一个批处理文件,它只是打开命令行并读取行......

它不是我需要的......


再次感谢,

Gidi。


" Gilles Kohl [MVP]"写道:
Thanks,

but i already read this, and it''s not quite helping me, since it''s not
executing a batch file, it''s just open command line and reading the lines...
it''s not what i need...

Thanks again,
Gidi.

"Gilles Kohl [MVP]" wrote:

2008年3月24日星期一02:56:00 -0700,Gidi< sh ***** @ hotmail.com.dontspamwrote:
On Mon, 24 Mar 2008 02:56:00 -0700, Gidi <sh*****@hotmail.com.dontspamwrote:




在我的windows应用程序中,我需要执行一个批处理文件。

this批处理文件将一些文本和问题抛到屏幕上,我需要

捕获标准输出,检查是否是一个问题,万一这是一个问题,

i想要弹出一个messageBox或者什么东西,然后带回批处理文件

结果(Yes \No question)。我知道如何执行批处理文件并在最后得到所有

标准输出,但我不知道我能通过

行和检查它是否是一个问题,如果是,请将结果带回

批处理文件。


有人可以帮我吗?
Hi,

In my windows applicationm, i need to excute a batch file.
this batch file throws some text and questions to the screen, i need to
catch the standard Output, check if it''s a question, in case it''s a question,
i want to popup a messageBox or something, and bring back to the batch file
the result (Yes\No question). I know how to excute the batch file and get all
the Standard output at the end, but i don''t know who can i read it line by
line and check if it''s a question, and in case it is, bring the result to the
batch file back.

can anyone help me here?



嗯,检查这个MSDN条目中包含的样本是否有帮助 - 听起来好像

大概就像你打算做的那样...

http: //msdn2.microsoft.com/en-us/lib...treadline.aspx


问候,

Gilles。


Hmm, check if the sample contained in this MSDN entry helps - sounds
approximately like what you intend to do ...

http://msdn2.microsoft.com/en-us/lib...treadline.aspx

Regards,
Gilles.


如果您知道如何读取所有标准输出,那么只需在换行符上分割

输出。然后你会有问题和

回复。也许我不明白你遇到问题的地方。

你应该包含一小段运行批处理文件的代码并读取

输出,澄清你的位置值得关注的是。


" Gidi"写道:
If you know how to read in all the standard output, then just split the
output on newline characters. You then would have the questions and
responses. Perhaps I''m not understanding where you are having the problem.
You should include a small set of code that runs the batch file and reads the
output clarifying where your concern is.

"Gidi" wrote:




在我的windows应用程序中,我需要执行一个批处理文件。

这个批处理文件会向屏幕抛出一些文字和问题,我需要

捕获标准输出,检查它是否是一个问题,万一这是一个问题,

i想要弹出一个messageBox或者其他东西,然后带回批处理文件

结果(Yes \No question)。我知道如何执行批处理文件并在最后得到所有

标准输出,但我不知道我能通过

行和检查它是否是一个问题,如果是,请将结果带回

批处理文件。


有人可以帮我吗?


谢谢,

Gidi。
Hi,

In my windows applicationm, i need to excute a batch file.
this batch file throws some text and questions to the screen, i need to
catch the standard Output, check if it''s a question, in case it''s a question,
i want to popup a messageBox or something, and bring back to the batch file
the result (Yes\No question). I know how to excute the batch file and get all
the Standard output at the end, but i don''t know who can i read it line by
line and check if it''s a question, and in case it is, bring the result to the
batch file back.

can anyone help me here?

Thanks,
Gidi.


这篇关于使用标准输出和输入运行批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆