Public Function GetCommandLine(strCommand As String) As String
Dim myExec As Object
Dim result As String
With CreateObject("WScript.shell")
Set myExec = .Exec("cmd /c " & strCommand)
End With
Do While myExec.Status = WshRunning
GetCommandLine = GetCommandLine & myExec.StdOut.ReadAll
DoEvents
Loop
GetCommandLine = GetCommandLine & myExec.StdOut.ReadAll 'Make sure we've got the lot
End Function