Microsoft Developer Network > Forums Home > Software Engineering Discussion Forums > Software Testing Discussion > How can i pass parameters to a batch file from QTP script
Ask a questionAsk a question
 

QuestionHow can i pass parameters to a batch file from QTP script

  • Friday, November 06, 2009 10:29 AMravikaanthe Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi gals/guys

    How can we Run a Batch file from  QTP script.
     
    My Batch file contains 3 variables (%1, %2, %3). I need to pass these variables values from QTP script. Please send me a sample piece of QTP script

    OR

    I am trying to download all required files from VSS by using QTP. So i prepared a batch (.bat) file which contains 3 variables. But these variable values need to pass from QTP while running the script. So please tell me the piece of QTP script code to pass values to a Batch file (.bat file)

All Replies

  • Tuesday, November 17, 2009 12:51 PMInder P Singh Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Try something on the following lines:

     

    Dim BatchRun
    Set BatchRun = CreateObject ("WSCript.shell")
    BatchRun.Run "
    cmd /K c:\abc.bat v1 v2 v3"
    Set BatchRun = Nothing

     

    Replace c:\abc.bat with the path of your batch file and v1 v2 and v3 with the values of the variables that you want to pass from the tool to your batch file.

     

    Thank you,

    Inder P Singh