how to use command prompt using qtp?
Answers were Sorted based on User's Feedback
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 |
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 |
Answer / king
Set =createobject("wscipt.shell")
a.run "cmd /K CD C:\ & Dir"
| Is This Answer Correct ? | 5 Yes | 4 No |
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 |
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 |
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 |
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 |
If I want to run more than one test (With different functionality) with in one script, then what i do? plz. explain with any example.
can i change the runtime properties of an object ? How can i check if a parameter exists in database ?
Can you write User defined function for WebEdit ? Note1: This function can be used for all web edits in all pages Note2: Don't use Child objects method
After running scripts how you report results ,there is any specific report form
What is text check point and text area check point?
What are the types of object repository in qtp?
QTP script is not working on other's machine..
1. I have asked the same question for the third time, but i am getting wrong answers. Pls give me the script to count the number of edit boxes or checkboxes in an windows application screen. In windows application childobject is not working, anyone very urgent
Hello Everyone, I have a problem. QTP is capturing no action on a particular page in the application that I am trying to automate. But on the same side its working fine on other pages of the same application. Can someone please help me understand the reason behind this inconsistency.
What if recovery scenarios is also failed for identify the alert ? (We are handling unexpected popup through recovery scenarios but if still recovery scenarios also failed than what should be the approach)
i have read that "non-reusable actions can not be called in any other test".but in 'call to copy action' copies non-reusable action in other test also..can u pls help to understand this..
What contains Data Driven Framework document in qtp?