p.StartInfo.FileName = "cmd.exe"
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardInput = True
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.RedirectStandardError = True
p.StartInfo.CreateNoWindow = True '不想看见那个黑黑的dos窗口
p.Start()
p.StandardInput.WriteLine("pint -n 1 192.168.10.100") '不小心把ping写成pint了
p.StandardInput.WriteLine("ping -n 1 192.168.10.100")
p.StandardInput.WriteLine("exit")
Dim strRet As String
strRet = p.StandardOutput.ReadToEnd()
MsgBox(strRet)
strRet = p.StandardError.ReadToEnd()
MsgBox(strRet)
转载于:https://www.cnblogs.com/HappyQQ/archive/2008/01/28/1056818.html