How to pass a variable in Dos Command using QTP?
Eg:
Dim path1, path2
path1 = "C:\Test\sample1.doc"
path2 = "C:\Test\sample2.doc"

How can we pass these path1 and path2 inside the "copy" dos
command?
I tried like this. this is not working.

oShell.run "cmd /K copy" &path1 &path2



How to pass a variable in Dos Command using QTP? Eg: Dim path1, path2 path1 = "C:\Test\sampl..

Answer / raghuram

Dim oShell
Set oShell = CreateObject ("WSCript.shell")
oShell.run "cmd /K CD C: & Dir"
Set oShell = Nothing

I was able to do in this way....you can try and let me know

Is This Answer Correct ?    3 Yes 6 No

Post New Answer

More QTP Interview Questions

1.How recognize QTP Dyanamic Image? (suppose tha wedpage contains 3 logos..1 square 2.circle 3.rectangel)there changing at same position how to capture that)

3 Answers   Synechron,


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,


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

2 Answers   Syntel,


IN A WEB PAGE THERE IS TWO WEB BUTTON WITH SAME OBJECT PROPERTY AND VALUE, SO HOW I WILL IDENTIFIE OBJECTS INDIVISUALY.

3 Answers  


How to return a value from a fn, if it has more than one value how to return

3 Answers   Verizon,


Hoe can we do retesting using functions please give the code for it using login page

0 Answers  


w is time parameter

1 Answers   Syntel,


HOW do we find a datasheet when there are 4 datasheets in data table.this question was asked by covansys interview.

5 Answers   CTS,


We stored into the objects OR and then write the scripting

0 Answers   L&T, Wipro,


who is the best faculty in HYD? Nageshwar rao or GC reddy?

3 Answers  


Hi Friends, I'm new to QTP. I want to write a function in QTP for below senario. In an Excel sheet column B, I Have 10 Url/Links, and in Colum A there is a Flag as Y and N. My test should run only on those iterations which are flagged as Y. Please help, Thanks

6 Answers  


How do i relate the checkbox properties with webelement when checkbox properties are changing on every login to the application

1 Answers   TCS,


Categories