Process.Start WaitForExit

VNote 2017.07.05 10:15:56 *: Dim p As New Process
Dim info As New ProcessStartInfo
info.UseShellExecute = False
info.CreateNoWindow = True
info.FileName = "cmd.exe"
info.Arguments = "/c dir *.*"
info.RedirectStandardOutput = True
p.StartInfo = info
p.Start()
p.WaitForExit()
MsgBox (p.StandardOutput.ReadToEnd())
Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim p As New Process
        Dim info As New ProcessStartInfo
        info.UseShellExecute = False
        info.CreateNoWindow = True
        info.FileName = "cmd.exe"
        info.Arguments = "/c pause"
        info.RedirectStandardOutput = True
        p.StartInfo = info
        p.Start()
        p.WaitForExit()
        REM MsgBox(p.StandardOutput.ReadToEnd())
        MsgBox("end")
    End Sub
End Class