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

we have a link in a website or webtable How can we record link in that table or site? link is not static we don't know exact location of that link? how ? if u know pls give reply with script also?

6 Answers   Cognizant, Covansys,


How is test case write?

0 Answers  


iam have done mba(finance)in 2008. in 2008 one reputed consultancy came off campus interview our institution. i got job as "manual test engineer". now iam working as "manual testing engineer". now my problem is when iam going interview the interviewer asking like " ur mba gradute how can u get job in test engineer." this question i have faced every interview. iam explaining how iam getting job. but they are not trust me". pls tell me answer how i am giving relavent ans.. this is my mail id y.ramana84@gmail.com

0 Answers  


how will load the object during runtime?

0 Answers  


How to create a standard checkpoint ?

0 Answers  






Reverse a string keeping the words in the string as it is. E.G. "Quick Test Professional" O/P "Professional Test Quick"

5 Answers   Cap Gemini,


is it possible to change the date format like MM/DD/YY into DD/MM?YY through script in QTP

5 Answers   IBM,


Both static and dynamic arrays are handled by the vb script. Is it true?

0 Answers  


Hi, I have 50 test cases for automation, Based on which criteria we can decide for these test cases we have to use Descriptive programming and remaining for general coding? Thanks In Advance..Kavitha

2 Answers  


Is QTP a compiler or interpreter..? can you we execute a QTP Script file in a another system which does not have QTP installed..??

6 Answers   Virtusa,


What is the Difference between test object and run time object?

0 Answers  


how to choose the framework in qtp ? 2)when we go for the descriptive programming ?

2 Answers   Syntel,


Categories