VBS读取cmd命令的输出,VBS执行程序后重定向到VBS

用于在VBS中执行外部程序,并且把结果重定向到VBS中

Set objShell = CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec ("%comspec% /c " & wscript.arguments(0))
Do While Not objExecObject.StdOut.AtEndOfStream
	strText = objExecObject.StdOut.ReadAll()
loop
msgbox strText





你可能感兴趣的:(cmd)