您将需要使用WshShell对象的Exec方法而不是Run.然后只需从标准流中读取命令行的输出.试试这个:
Const WshFinished = 1 Const WshFailed = 2 strCommand = "ping.exe 127.0.0.1" Set WshShell = CreateObject("WScript.Shell") Set WshShellExec = WshShell.Exec(strCommand) Select Case WshShellExec.Status Case WshFinished strOutput = WshShellExec.StdOut.ReadAll Case WshFailed strOutput = WshShellExec.StdErr.ReadAll End Select WScript.StdOut.Write strOutput 'write results to the command line WScript.Echo strOutput 'write results to default output MsgBox strOutput 'write results in a message Box