以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  请问  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=143829)

--  作者:hbhb
--  发布时间:2019/12/5 13:00:00
--  请问
大师:请问狐表如何读写系统运行cmd命令后界面内容?
--  作者:有点蓝
--  发布时间:2019/12/5 14:10:00
--  

Dim p As new Process()
p.StartInfo.FileName = "cmd.exe"
p.StartInfo.UseShellExecute = False \'关闭Shell的使用
p.StartInfo.RedirectStandardInput = True \'重定向标准输入
p.StartInfo.RedirectStandardOutput = True \'重定向标准输出
p.StartInfo.RedirectStandardError = True \'重定向错误输出
p.StartInfo.CreateNoWindow = True
p.Start()

p.StandardInput.WriteLine("ping /?" & vbcrlf & "exit")
Output.Show(p.StandardOutput.ReadToEnd)
p.WaitForExit()