How to capture the powershell result on calling the external application(.exe with arguments)
I am trying to run powershell command through TestComplete, command to call the external application(.exe) with argument. And the command returns the message to the powershell console.
Unable to read the message displayed in the powershell console through TestComplete.
Below is the format of the command am using to exec through TestComplete:
var PowerShellObj = Sys.OleObject("WScript.Shell"); var Command = "C:\cmd_tool.exe --list-data"; var oExec = PowerShellObj.Exec("powershell -command "+Command );
Manually when I run the same command in powershell console, I could see the message displayed on the console.
Thanks in advance.
Karthik K R
Solved! Go to Solution.
You've already stated the key problem... you can see it on the console. so, you would need to write code in TestComplete to scrape the screen of the console to grab the information. Alternatively, you could have Powershell output the information to a file that can then be read by TestComplete. But that's really the key... you need to code TestComplete to find the information.
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Thanks for the suggestion.
I have got the problem resolved. I was using the StdOut.ReadAll() to get the console output.
Karthik K R