无法重定向标准输入

时间:2015-11-20 17:07:34

标签: .net vb.net cmd

在我确切地知道我在寻找什么之前,我用不同的标题问了这个问题;以明确的标题重新发布它希望我会得到一些答案。

我正在尝试将标准输入重定向到应用程序,以便我可以从我的Visual Basic程序中控制它。

Public Class MyClass
    Dim StreamWriteUtility As System.IO.StreamWriter
    Dim StreamReadUtility As System.IO.StringReader
    Dim ProcessInfo As ProcessStartInfo
    Dim Process As Process

    Public Sub StartUSBCapture(ByVal DataStorageLocation As String)

        ProcessInfo = New ProcessStartInfo("C:\FW_Qualification_Suite\data-center-windows\data-center\bin\datacenter.cmd", "-c ")
        ProcessInfo.CreateNoWindow = True
        ProcessInfo.UseShellExecute = False 'Must be changed if redirect set to True
        ProcessInfo.RedirectStandardInput = True

        Process.Start(ProcessInfo)

        StreamWriteUtility = Process.StandardInput

        While True
        StreamWriteUtility.WriteLine("run") 'Looping for test to ensure this isn't a timing issue
        End While
    End Sub
End Class

0 个答案:

没有答案