如何在vb.net中获得特定的命令行promt输出

如何在vb.net中获得特定的命令行promt输出,vb.net,windows,cmd,Vb.net,Windows,Cmd,我需要获取命令提示符行输出的特定行,并将其保存在vb.net中的字符串变量中 请告诉我如何将行输出表单命令提示符获取到vb.net,以及如何获取特定行。基本上,您需要启动该过程,然后捕获标准输出。下面的代码将帮助您 Dim process As New Process() Dim startInfo As New ProcessStartInfo("YourApplication.exe", "arguments") startInfo.UseShellExecute =

我需要获取命令提示符行输出的特定行,并将其保存在vb.net中的字符串变量中


请告诉我如何将行输出表单命令提示符获取到vb.net,以及如何获取特定行。

基本上,您需要启动该过程,然后捕获标准输出。下面的代码将帮助您

   Dim process As New Process()
    Dim startInfo As New ProcessStartInfo("YourApplication.exe", "arguments")
    startInfo.UseShellExecute = False
    startInfo.RedirectStandardOutput = True
    process.StartInfo = startInfo
    process.Start()

    Dim output As String
    Using streamReader As System.IO.StreamReader = process.StandardOutput
        output = streamReader.ReadToEnd()
    End Using

完成后,您需要创建一个包含
输出
内容的文件,并从中读取特定行

您的意思是从流程中捕获输出?是的,我还需要从中获取特定行。