I asked a similar question elsewhere, but maybe I did not ask it correctly, or I was not clear enough, so I ask again.
This is where I want:
- Open a Windows command prompt
- Launch a DOS application using the dos command
- Read the returned text that appears in the dos field and show it in the text field in my window form. This must be repeated at regular intervals (say, every second), and the dos window should not close.
I traveled around circles trying to use the Process and StartInfo commands, but they start the application and close the process immediately. I need to open a dos window and continue reading any new text that is added to it by the dos application. I also came across this thread, which seems to be responding to my problem, but it is in C #, and I was not able to convert it:
Read STDOUT Windows Command Prompt
I ended up in the part where I open the command line and launch the application, but I don’t know how to read the data that it returns to the dos window console from time to time. I want to constantly check for changes so that I can act on them, possibly using a timer.
Please, help.
Thank!
I ran the code that was kindly provided by Stevedog and used it as follows:
Private WithEvents _commandExecutor As New CommandExecutor()
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
_commandExecutor.Execute("c:\progra~2\zbar\bin\zbarcam.exe", "")
End Sub
Private Sub _commandExecutor_OutputRead(ByVal output As String) Handles _commandExecutor.OutputRead
txtResult.Text = output
End Sub
, , - dos. zbarcam , , , QR-, dos, sub _commandExecutor_OutputRead , DOS.