If you are programming a Windows Script in VBScript and need to retrieve the output of an external command you can use the following simple function:

Function GetCommandOutput(filename)  
  Dim WshShell, oExec  
  Set WshShell = CreateObject("WScript.Shell")  
  Set oExec    = WshShell.Exec(filename)   
  Do While oExec.Status <> 1    
    GetCommandOutput = GetCommandOutput & oExec.StdOut.ReadLine() & vbCrLf  
  Loop 
End Function