|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Redirecting IO from a console application to .NetI am trying to run a third party console application from a .Net program and redirect it's IO to a streamreader and streamwriter in my program. However, when I run the code below. The third party console application compalins that it cannot run as a service. Is there another way that I can start that application and do IO to it, while it believes it runs interactively as a console app? The code I tried is here below. Thanks in advance for your help. Dim consoleApp As Process Dim consoleIn As StreamWriter Dim consoleOut As StreamReader Dim consoleErr As StreamReader Dim result As String consoleApp = New Process consoleApp.StartInfo.FileName = "c:\tpdir\tpapp.exe" consoleApp.StartInfo.RedirectStandardError = True consoleApp.StartInfo.RedirectStandardInput = True consoleApp.StartInfo.RedirectStandardOutput = True consoleApp.StartInfo.UseShellExecute = False consoleApp.Start() consoleIn = consoleApp.StandardInput consoleOut = consoleApp.StandardOutput consoleErr = consoleApp.StandardError consoleIn.WriteLine("command") result = consoleOut.ReadLine Console.WriteLine(result) |
|||||||||||||||||||||||