Output from process.start

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I get the output from a process.start.

Example:

Process.Start("c:\windows\system32\rp", PrintQueue & " " & filename,
Username, pass, ComputerName)

How do I get the output of this into a string?
 
Philip Wagenaar said:
How can I get the output from a process.start.
Example:
Process.Start("c:\windows\system32\rp", PrintQueue & " " & filename,
Username, pass, ComputerName)

How do I get the output of this into a string?

Look into launching your process using the ProcessStartInfo class :

Dim starter as New ProcessStartInfo( _
"rp" _
, PrintQueue & " " & filename _
& " " Username _
& " " & pass _
& " " & ComputerName _
)

With starter
.WorkingDirectory = "c:\windows\system32"
.RedirectStandardOutput
End With

Process.Start( starter )
Process.WaitForExit()

If Process.StandardOutput.ReadToEnd().IndexOf( "ERROR" ) > -1 Then
' Oops
End If

HTH,
Phill W.
 
Hi Guys,

I have probably similar situation...if someone could help?
I have following code for my vb 2005 application.

Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PictureBox2.Click
Dim ProcStartInfo As New System.Diagnostics.ProcessStartInfo()
ProcStartInfo.FileName = "C:\WINDOWS\system32\mspaint.exe"
ProcStartInfo.Arguments = "C:\drawing\bambi28.bmp"
ProcStartInfo.WorkingDirectory = ""
ProcStartInfo.UseShellExecute = False
ProcStartInfo.CreateNoWindow = True
ProcStartInfo.RedirectStandardOutput = True
ProcStartInfo.WindowStyle = ProcessWindowStyle.Normal
System.Diagnostics.Process.Start(ProcStartInfo)

End Sub

on my form I have splitcontainer with 2 panel, in left panel I have
picturebox which user will click and on right panel, I want to open paint
INSIDE.
right now, when I execute code, it opens microsoft paint but it is seperate
window.

(in nutshell, all I want is when user clicks picture icon on left panel, ms
paint to open in right panel with that picture).

I would appreciate any help. Thanks.
 
Back
Top