how to use command prompt using qtp?

Answers were Sorted based on User's Feedback



how to use command prompt using qtp?..

Answer / shobhit kaul

hi frnds in the above answer(by king) there is only one
change

as inspite of creating object of quicktest.applicaton
you should create object of wscript.shell
The code is as::

Set app=CreateObject("Wscript.shell")
SystemUtil.run("cmd.exe")
app.sendkeys "cd\"
app.sendkeys "~" 'its for enter key
app.sendkeys "default.xls" 'this xls should be any where
your c drive

app.sendkeys "~"



Please correct me if i am wrong any where
my emai id is
kaul.shobhit@gmail.com

Is This Answer Correct ?    13 Yes 4 No

how to use command prompt using qtp?..

Answer / mahi

using "Wscript.Shell" object we can work on command prompt
in qtp.

'create one instance for "wscript.Shell"
set oShell=CreateObject("Wscript.Shell")
'using run method we can invoke application
'/k this will display command prompt.we can also use /c but
we can not see command prompt.It will disappear after
executeion.
oShell.Run "cmd /k dir"
'if we want use multiple commands we can use "&"(amp) symbol
oShell.run "cmd /k dir & md qtp"
set oShell=Nothing

I hope it will useful.
Regards,
Mahi.kotike@gmail.com

Is This Answer Correct ?    9 Yes 5 No

how to use command prompt using qtp?..

Answer / king

Set =createobject("wscipt.shell")
a.run "cmd /K CD C:\ & Dir"

Is This Answer Correct ?    5 Yes 4 No

how to use command prompt using qtp?..

Answer / r.prasad

hi ,
u can open command prompt using following script also



dim app
set app=createobject("QuickTest.application")
SystemUtil.run "cmd.exe"

Is This Answer Correct ?    6 Yes 5 No

how to use command prompt using qtp?..

Answer / king

Hi Bathi,

dim app
set app=createobject("QuickTest.application")
SystemUtil.run "cmd.exe" 'the command prompt open
app.sendkeys "cd\"
app.sendkeys "~"
app.sendkeys "cd Foldername"
app.sendkeys "~"
app.sendkeys "dir *.xls"
app.sendkeys "~"

i think this is working properly accoring to my knowledge.

Is This Answer Correct ?    4 Yes 3 No

how to use command prompt using qtp?..

Answer / sandeep

To know ALL .XLS FILES in the folder. Please use file
system object.

Create file system object.

Check using fileExists method.

You can also make array of .xls file and return the array.

Is This Answer Correct ?    1 Yes 1 No

how to use command prompt using qtp?..

Answer / bathi

Hi King,

Thanks 4 the ans.

I want have still more clarification abt this. suppose I
want to know list all excel sheet present in some folder
using console. how can i do that?

Is This Answer Correct ?    2 Yes 3 No

how to use command prompt using qtp?..

Answer / ravi_kanakam

Hi King

app.sendkeys showing error..

Is This Answer Correct ?    3 Yes 5 No

Post New Answer

More QTP Interview Questions

what will be the stmt if record any edit box in the Web application ?

2 Answers   eSymbiosis,


from what stage you will start automation in your project

5 Answers   TCS,


Hi all, On recording a particular Web application with QTP,Have came across a problem for which I havent found a solution so far.. The script of importance is as follows: Browser("Personalized Start Page").Page("XYZ").Frame ("mainFrame_4").Link("address.csv").Click Browser("Personalized Start Page").Page("XYZ").Sync Dialog("0% of dms.php from XYZ-").Dialog("File Download").WinButton("Save").Click My problem is that on recording the application with QTP and clicking the "address.csv" link another browser window comes up temporarily followed by the Windows "FileSave" dialog.The browser window which came up closes down when the Windows "FileSave" dialog is visible and I save the file to a windows location. On the "Record and Run" settings under Qtp,have activated settings for web and windows applications. But when I run this recorded script,and after the "address.csv" click,The browser window comes up and goes down,No Windows "FileSave" dialog comes up and the QTP shows the error Dialog("0% of dms.php from XYZ-") object is not found,though this object is there in the repository. Have tried putting the Dialog("0% of dms.php from XYZ- ").Exist property.But the "Exist" property is not recognised by the dialog at all. Any help in this direction is appreciated.. Thanks in advance J

1 Answers   ADP,


what is defination of system testing?

3 Answers   CodeArrow, Infosys, Omax,


What is the difference between local and shared object repository in qtp?

0 Answers  


Inserting a Call to Action is not importing all columns in Datatable of globalsheet. Why?

1 Answers   Crea,


When i use paramateriztion for tickets in flight reservation application , the tes'll run for first iteration but for the second iteration it'll give this details, but the second iteration is failed. Pls anyone clarify it. Cannot find the "Agent Name:" object's parent "Login" (class Dialog). Verify that parent properties match an object currently displayed in your application.

2 Answers  


How to use checkpoints in qtp ?

0 Answers  


How can you identify the browser and its information using QTP script?

0 Answers  


How do you handle multiple banners(at the top the page, the banner is scrolling) in a web page(Dont take the name property(regular expression))

0 Answers   CFC, iton,


What is the basic concept of qtp?

0 Answers  


what are the metrics in general we use in testing

1 Answers   Tanla Solutions,


Categories