derek7467
asked on
vb.net and writing cmd line output to listview
I am attempting to output command prompt data to a listview, which works but im having a few issues. The command prompt window never exits to load the data to the listview, i have to click X and then it closes and loads the info to the listview. When it does load it to listview, it doesnt separate the info out into 2 separate columns which i have created in the listview properties:
Dim psi As New ProcessStartInfo("cmd.exe")
psi.Arguments = String.Concat(" /K systeminfo /S ", Form1.TextBox1.Text)
psi.RedirectStandardOutput = True
psi.WindowStyle = ProcessWindowStyle.Hidden
psi.UseShellExecute = False
Dim pExec As New Process()
pExec = Process.Start(psi)
Dim output As StreamReader = pExec.StandardOutput
pExec.WaitForExit()
If pExec.HasExited Then
Dim line As String
Do
line = output.ReadLine()
If Not line Is Nothing Then
ListView1.Items.Add(line)
End If
Loop Until line Is Nothing
output.Close()
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.