1

我知道如何通过startinfo.arguments. 我想我什至知道如何“听”孩子可能通过standardoutput.readline. 我不知道孩子用什么方法向父母“说话”。这是我到目前为止的代码(在父方):

Dim proc As Process
Dim bRunProgramWorked As Boolean = True
Try
    proc = New Process
    Dim procInfo As New ProcessStartInfo
    proc.StartInfo.FileName = strPathUpgradeEXE
    proc.StartInfo.Arguments = param1 & " " & param2 & " " & param3
    proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
    'proc.StartInfo.WindowStyle = ProcessWindowStyle.Maximized
    proc.StartInfo.UseShellExecute = False
    proc.StartInfo.CreateNoWindow = True
    proc.StartInfo.RedirectStandardOutput = True
    'proc.StartInfo.RedirectStandardError = True
    proc.Start()
    Dim output1 As String = proc.StandardOutput.ReadLine
    Dim output2 As String = proc.StandardOutput.ReadLine
    proc.WaitForExit()
    proc.Close()
    proc.Dispose()
Catch ex As Exception
    LogIt(strMyBaseID, "Error at trying to run PVT-Export. " & ex.ToString)
    bRunProgramWorked = False
End Try
4

1 回答 1

2

子进程需要写入Console.Out.

于 2013-10-16T16:27:33.030 回答