How can I run batch file and get output in code and command window from my Visual Basic .NET cod

Hello,

I have an batch file which needs to be executed from my VB.NET application.

I have successfully done that using System.Diagnostics.Process class
and openning command window from that..

But my requirement have changed a little bit..

Now i need StandardOutput and StandardError both to be returned after the
execution in both command window and VB.NET Code..

I tried the same with process class..
But It allows either on command window or VB.NET code.

Any ideas how to achieve this.

Thanks in advance.

Regards
Amit Pandya

[570 byte] By [AmitPandya] at [2007-12-16]
# 1
I would suggest redirecting StandardOutput/StandardError to my application and let my application echo whatever it reads from stdout/stderr to the console window using System.Console.WriteLine()

Best regards,
Johan Stenberg

JohanStenberg at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2
Hello,

I cann't redirect StandardOutput/StandardError as my batch file needs
input from user after some line execution..

And i don't know what would be the input.
Based on the input batch file will proceed the execution...

There are many batch file so i cann't fix the same.

Is there any otherway than process class with which i can perform the task.

Regards
Amit Pandya

AmitPandya at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 3
How does the batch file get its input? From StandardInput or does it read directly from the console?

It sounds like the problems that you have here are more related to having two processes sharing the same console than with the Process class itself...

Best regards,
Johan Stenberg

JohanStenberg at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified