Absent Member.. Absent Member..
Absent Member..

Automate unix batch processing using QTP


I am trying to automate unix batch execution using QTP. Previously I was using SendKeys method to send the input from QTP to the putty console. But I want to have it more robust so that I can put some data/response checks.

So I am trying PLINK to execute the unix command from DOS prompt. I am able to execute the unix command and read the data from the DOS prompt using following code:

Set objShell = CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec("cmd /c C:\Putty\PLINK\plink.exe")
Do While Not objExecObject.StdOut.AtEndOfStream
strText = objExecObject.StdOut.ReadLine()
MsgBox strText
If Instr(strText, "Reply") > 0 Then
MsgBox "Reply received.:"& strText
Exit Do
End If

However their are two problems I am facing at this point:

1. DOS prompt disappears after the objShell.Exec method finish execution?

I need it active/visible and running so that I can execute more command in the same session/comsole.

2. I am not sure how to pass command line argument (e.g. below XXX).

objShell.Exec("cmd /c C:\Putty\PLINK\plink.exe XXX")

which is required to for the unix authorization at the begining of unix server connection.

OR If there is any other method to create object of the Command/DOS prompt, so that we can READ/WRITE data using QTP/VbScript?

I would appreciate any suggestions on this.

1 Reply
Absent Member.. Absent Member..
Absent Member..

Re: Automate unix batch processing using QTP

I have changed the following code:
Set objExecObject = objShell.Exec("cmd /c C:\Putty\PLINK\plink.exe")

Set objExecObject = objShell.Exec("cmd /k C:\Putty\PLINK\plink.exe")

Command prompt remains active/visible on the desktop, and STDOUT returns the execution result.

However, I can't see any data in Open command window?
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.