Run the program under DOS and get the result

xiaoxiao2021-03-06  40

'Imports System.Diagnostics Dim P As New Process

P.StartInfo.FileName = "cmd.exe"

P.StartInfo.uShellexecute = false

P.StartInfo.RedirectStandardInput = TRUE

P.StartInfo.RedirectStandardOutput = TRUE

P.StartInfo.RedirectStandarderror = TRUE

P.StartInfo.createnowindow = true 'Don't want to see the black DOS window

P.Start ()

P.Standardinput.writeline ("PINT-N 1 192.168.10.100") 'accidentally writes ping into PINT

P.Standardinput.writeLine ("ping -n 1 192.168.10.100")

P.Standardinput.writeline ("exit")

DIM STRET AS STRING

Strret = p.standardoutput.readToend ()

MsgBox (STRRET)

Strret = p.standarderror.readToend ()

MsgBox (STRRET)

转载请注明原文地址:https://www.9cbs.com/read-54107.html

New Post(0)