| 
    
     |  | WSH5.6から実装されている、WshShellオブジェクトのExecメソッドを使い それが返すオブジェクトで、StdOutチャンネルにアクセスする。という方法が
 あるようです。
 
 Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
 Sub MyTest_Std()
 Dim WShell As Object, oExec As Object
 Dim Buf As String
 
 Set WShell = CreateObject("WScript.Shell")
 Set oExec = WShell.Exec("Command.com /C CD") 'NT系のOSなら cmd.exe
 Do Until oExec.StdOut.AtEndOfStream
 Buf = Buf & oExec.StdOut.ReadLine
 If oExec.Status = 1 Then Exit Do
 Sleep 100
 Loop
 MsgBox Buf
 Set oExec = Nothing: Set WShell = Nothing
 End Sub
 
 |  |