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

Why do we use "Text checkpoint" If we can make use of it in "standard checkpoint" ?

0 Answers   IBM,


Is virtual object supported in low level recording mode?

0 Answers  


What is diff betwee datatable.importsheet "path" and datatable.import

2 Answers  


Suppose u write test case in Excel sheet . how u open that test case in Test Director?

4 Answers   Ordain Solutions,


In Webtable New rows getting added, we have select the name as Sandeep ,If name column is sandeep then need to check the checkbox ,we don't know the rows and columns ,Can anyone please tell me the answer.

3 Answers   Broadridge, Cigniti Technologies, HCL,






Where we save all scripts in the QTP

5 Answers   Ordain Solutions, Sathya Technologies,


Can anybody give the script of below things. 1. Add sheet 2. Adding columns 3. Set the values in that columns(In the rows) 4. Close the sheet 5. How can we create 3 sheets in one Excel sheet??

2 Answers   TCS,


What is the difference between per-action and shared?

0 Answers  


Greetings friends , Hope all of you are doing well. When I run a test, is it possible for me to for me to take each row from the data table , once at a time. In other words,if i have 10 rows in the global data table, say data1,data2, data 3...and so on up to data10. Can I have the value of data1 when I run a test, and next time when I run the same test (say next day), it should skip data1 as it has already used it and go directly to data 2 ??? Would be great if anybody can help me out know in this issue. Thanks & Regards !!

4 Answers   CTS,


What does ".mst" stands for? (abc.mst)

3 Answers   Infosys,


How can we import into Excel "Details" ,"Result" ,"Time" parameters from within a Results Report which is generated after a Run error when a script is executed in QTP? Refer E.g below Status Functionality Description RunDate Fail Login User should be able to Login 12/3/2007 StartTime EndTime Details* 1:31:58 PM 1:32:29 PM (this one i want)

0 Answers  


Explain the concept of object repository & how QTP recognises objects?

1 Answers  


Categories