StandardOutput ReadLine, pause halt process. RRS feed

  • Question

  • Hi guys, i have a code: 

            Dim ProcInfo As New ProcessStartInfo With {.FileName = AppName, .WorkingDirectory = Path.GetDirectoryName(AppName), .CreateNoWindow = False, .Arguments = Arguments, .RedirectStandardInput = False, .RedirectStandardOutput = True, .RedirectStandardError = True, .UseShellExecute = False}
            Dim App As Process = Nothing
    		Dim Result As Integer = 0
            If File.Exists(AppName) Then
                    App = Process.Start(ProcInfo)
                    Console.WriteLine("App name: {0}" + Environment.NewLine, App.StartInfo.FileName)
                            ' The StandardOutput don't read lineas when app is stop, when wait for something
                            Do Until App.StandardOutput.EndOfStream
    							Console.WriteLine(App.StandardOutput.ReadLine) ' "Press any key key to continue ..." not readed
                        Loop While Not App.HasExited
                Catch ex As Exception
                    Console.WriteLine("{0}", ex.Message)
                End Try
                Result = App.ExitCode
                    Console.WriteLine("Could not start process: {0}", App.StartInfo.FileName)
                    Return False
                    If Not App Is Nothing Then
                    End If
                End Try
    What i'm trying to do is write text from console windows,  for example  when i have in batch code "pause"  (ex.  cmd.exe /c echo ABDEDFG & echo 0123456789 & pause) VB doesn't see it, i'll see pause message after hit any key, i would like to get "please press any key" message in the same time when it is in console window. Could you help me with this  ?

    Thursday, February 12, 2015 1:57 PM


  • Please post your question here : 


    Arnav Sharma | http://arnavsharma.net/ Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    • Marked as answer by arnavsharma Thursday, February 19, 2015 10:15 PM
    Thursday, February 12, 2015 10:57 PM