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

When I used random numbers(1 to 9) with regular expression and run the test, it runs only 5 iterations with passed result instead of running all 1 to 9. Please tell me what can be the reason

0 Answers  


What is checkpoint in qtp?

0 Answers  


How QTP recognize the object??how to add objcts into object repository??

3 Answers  


hi, for QTP TRAINING......SURESH REDDY SMART SOLUTIONS sr.nagar IS BEST OR NOT? how faculty teaches?

4 Answers   Cap Gemini,


How to export data present in Datatable to an ".xls" file?

1 Answers   Crea,






What is parameterization? What is syncronization pt.?

3 Answers   Semantic Space, SRM,


Hi any body can tell me the synchranization point syntax thanks in advance

6 Answers   AppLabs,


Explain the features and benefits of quick test pro(qtp)?

0 Answers  


How do u write a regular expression for date (dd/mm/yyyy) field?

10 Answers  


1)Difference Between Value & RawValue?

2 Answers   Wipro, Zensar,


When u r running a script , if u get a popup window that describing that u have received a mail to your outlook application. so to avoid the interference of the popup window , which recovery scenario(popup,object state,application hang,system crash) would u use ?

4 Answers   Accenture,


If an application name is changes frequently i.e while recording it has name "Window1" and then while running its "Windows2" in this case how does QTP handles?

1 Answers   Crea,


Categories