以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  判断CMD的执行  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=183526)

--  作者:fendouww
--  发布时间:2022/11/8 16:29:00
--  判断CMD的执行
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()
Dim bb As String = "echo f| xcopy """ & fi & """ """ & fi1 & """ /i /D /s /e /c /y /h"
p.StandardInput.WriteLine(bb)
p.StandardInput.WriteLine("exit")

请问如何判断CMD已经执行完毕和判断结果?

--  作者:有点蓝
--  发布时间:2022/11/8 17:06:00
--  
p.StandardInput.WriteLine("exit")
p.WaitForExit()
MsgBox("结束")