以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]我想在程序里调用外部程序怎么调用?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=71691)

--  作者:QFHSY
--  发布时间:2015/7/16 11:08:00
--  [求助]我想在程序里调用外部程序怎么调用?
如题,我想调用程序,而且调用的时候要带参数,怎么办?
--  作者:大红袍
--  发布时间:2015/7/16 11:10:00
--  

参考

 

http://www.foxtable.com/help/topics/0353.htm

 

 

--------------

 

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)


--  作者:QFHSY
--  发布时间:2015/7/16 11:15:00
--  
可以了,谢谢