Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I recently build a tiny app where I was interacting with batch files. I found this snippit of code that allowed me to do this:</p> <pre><code>Process proc = new Process { StartInfo = { RedirectStandardError = true, RedirectStandardOutput = true, UseShellExecute = false, } }; proc.Start(); string errorMessage = proc.StandardError.ReadToEnd(); proc.WaitForExit(); string outputMessage = proc.StandardOutput.ReadToEnd(); proc.WaitForExit(); </code></pre> <p>From here, just direct those strings into a usercontrol of your choice.</p> <hr> <p>EDITS </p> <blockquote> <p><strong>Note</strong>: This is not a general solution. It can lead to deadlocks. From the doc for <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.redirectstandarderror.aspx" rel="nofollow noreferrer">RedirectStandardError</a>:<br> Synchronous read operations introduce a dependency between the caller reading from the StandardError stream and the child process writing to that stream. These dependencies can cause deadlock conditions. When the caller reads from the redirected stream of a child process, it is dependent on the child. The caller waits for the read operation until the child writes to the stream or closes the stream. When the child process writes enough data to fill its redirected stream, it is dependent on the parent. The child process waits for the next write operation until the parent reads from the full stream or closes the stream. The deadlock condition results when the caller and child process wait for each other to complete an operation, and neither can continue. You can avoid deadlocks by evaluating dependencies between the caller and child process. </p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload