以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  用shell 命令启动ping,但是窗口不在最上层,请问怎么破?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=100827)

--  作者:ycwk
--  发布时间:2017/5/19 10:43:00
--  用shell 命令启动ping,但是窗口不在最上层,请问怎么破?
shell ("cmd.exe /c ping " & CurrentTable.Current("IP地址"))

启动的ping窗口在当前窗口的下面,不熟悉的人不容易注意到,有办法默认放到最前面来吗?

--  作者:有点色
--  发布时间:2017/5/19 11:00:00
--  
shell ("cmd.exe /c ping www.baidu.com", 1)
--  作者:有点色
--  发布时间:2017/5/19 11:03: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 www.baidu.com")
p.StandardInput.WriteLine("exit")

Dim strRst As String = p.StandardOutput.ReadToEnd()
msgbox(strrst)

 


--  作者:wfkbabro
--  发布时间:2021/9/8 11:19:00
--  
收藏。