Micro Focus QTP (UFT) Forums
How to read text in command prompt using QTP - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: How to read text in command prompt using QTP (/Thread-How-to-read-text-in-command-prompt-using-QTP)



How to read text in command prompt using QTP - Sourabh146 - 11-26-2013

Hi,

I am trying to perform some operations using command prompt. I am able to write something on command prompt but unable to fetch the output text from the command prompt. I had tried with GetVisibleText property for a window but its giving just the title of that window instead to the body.
Please suggest any alternative to fetch text from window(Command Prompt).

Thanks.


RE: How to read text in command prompt using QTP - ravi.gajul - 11-30-2013

you may try this approach
Code:
Set screen = CreateObject("WScript.Shell").Exec("%COMSPEC% /c date /t")
Do While screen.Status = 0
  WScript.Sleep 100
Loop
WScript.Echo screen.StdOut.ReadAll