Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- txtConsoleOut.Clear()
- psi = New ProcessStartInfo("Data\adbrecovery.bat")
- Dim systemencoding As System.Text.Encoding = _
- System.Text.Encoding.GetEncoding(Globalization.CultureInfo.CurrentUICulture.TextInfo.OEMCodePage)
- With psi
- .UseShellExecute = False ' Required for redirection
- .RedirectStandardError = True
- .RedirectStandardOutput = True
- .RedirectStandardInput = True
- .CreateNoWindow = True
- .StandardOutputEncoding = systemencoding ' Use OEM encoding for console applications
- .StandardErrorEncoding = systemencoding
- End With
- ' EnableraisingEvents is required for Exited event
- cmd = New Process With {.StartInfo = psi, .EnableRaisingEvents = False}
- AddHandler cmd.ErrorDataReceived, AddressOf Async_Data_Received
- AddHandler cmd.OutputDataReceived, AddressOf Async_Data_Received
- AddHandler cmd.Exited, AddressOf CMD_Exited
- cmd.Start()
- ' Start async reading of the redirected streams
- ' Without these calls the events won't fire
- cmd.BeginOutputReadLine()
- cmd.BeginErrorReadLine()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement