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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Presently i am working on QTP 8.2 Version,i want to know features in 9.2 version, because i have not sufficient time to put the effort on the 9.2 version

1392


How extensive or customized are the server logging and reporting requirements; are they considered an integral part of the system and do they require testing?

558


Hello everyone! I am just writing a small test for a windows application. I have a problem with a text output value. The value i am trying to catch is presented in a scrollable textbox. When the text is too long, only a portion of it gets captured. Do you have any experience with this?

2130


How do you capture tooltip using QTP?

625


how will you load the test cases in ddt?

1590






How to create scenario selector

1467


What is system testing and what are the different types of tests you perform in system testing?

589


why you have standardized functions? plzzz guys with real time exp. do answer

1425


Can any one send me the QTP Basic Coding Samples?

1599


I want to do QTP Certification what is the pattern of Question paper.

1732


I used the below code to open QTP through VBscript?But i can unable to Invoke QTP...PLZ help me with the correct code to invoke QTP through VBS with description of the code aswell. Dim qtApp 'As QuickTest.Application 'Declare the Application object variable Dim qtTest 'As QuickTest.Test 'Declare a Test object variable Dim qtResultsOpt 'Declare a Run Results Options object variable Set qtApp = CreateObject("QuickTest.Application") 'Create the Application object qtApp.Launch 'Start QuickTest qtApp.Visible = False 'Make the QuickTest application visible qtApp.Open "C:\form", True 'Open the test in read-only mode 'set run settings for the test Set qtTest = qtApp.Test qtTest.Run 'Run the test 'WScript.StdOut.Write "Status is: " & qtTest.LastRunResults.Status 'Check the results of the test run qtTest.Close 'Close the test qtApp.quit 'Close QuickTest Pro Set qtResultsOpt = Nothing 'Release the Run Results Options object Set qtTest = Nothing 'Release the Test object Set qtApp = Nothing 'Release the Application object

2408


Have you faced any problems with object repository?

584


What is the purpose of loading qtp add-ins?

612


What are the types of object repository in qtp?

555


Explain the concept of how quicktest professional identifies object?

522