1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim oProcess As New Process() Dim oStartInfo As New ProcessStartInfo("cmd.exe") oStartInfo.UseShellExecute = False oStartInfo.CreateNoWindow = True oStartInfo.Arguments = "/k ipconfig" oStartInfo.RedirectStandardOutput = True oProcess.StartInfo = oStartInfo oProcess.Start() Dim sOutput As String Using oStream2Str As System.IO.StreamReader = oProcess.StandardOutput sOutput = oStream2Str.ReadToEnd() End Using MsgBox(sOutput) Dim oStream2Lst As System.IO.StreamReader oStream2Lst = oProcess.StandardOutput Do ListBox1.Items.Add(oStream2Lst.ReadLine) Loop While oProcess.HasExited = False End Sub |
2020年6月13日 星期六
vb.net 取得cmd內容 [Get cmd content]
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言