How to invoke multiple batch files from LoadRunner


I want to invoke multiple batch files from  the load runner. Can someone suggest on the approach to do that.

I have tried to parameterize batch filenames and pass them to the System function but it is not working.

Looking for the suggestions ASAP.




  • Hi

    It's works for me with system command :     system("C:\\1.bat");

    I attach also a screenshot .

    Maybe you have any permission  issue to open CMD ,

    try launch VuGen as Administrator .





  • In addition to Orens reply,

    When you want to invoke the batch files in background (do not wait till the batch file completes) use the command:

        system("%ComSpec% /C start /B action.bat");

    Put your action.bat in your script directory, add it to Extra Files (else it is not transferred to your Load Generator).

    End your action.bat with the command 'exit' to close the command window. There is no need to parameterize your batch file names. It will make things more complicated. You might just use arguments for your batch file:

    system(lr_eval_string("%ComSpec% /C start /B action.bat {ARG1}"));

    My action.bat looks like

    :: Content action.bat
    echo %1


  • Hi Orenga,

    My requirement is to invoke a unique bat file for each iteration and respective user.

  • You have to have all the batch files available on your system or in your LR script directory.

    Accoding the documentation is there no evaluation of arguments on the system() call. So you have to code something like:


    to run the batch files from LR script directory. Prepend a fixed path if you store your batch files on a different location, like in the example of Orenga.

    Note that you have to maintain that path on your Load Generator and on your VuGen system.

    When you add the batch files to your LR script directory, you have to add those bat-files to the 'Extra Files' section in your Solution tree else they are not transferred to your Load Generator, but if that will be a couple of hunders of files that will not work. You might put them in a zip file, add the zip file to the 'Extra Files' section and extract it with a power shell script (PS has a unzip api). An other way is to have one batch file and use the user and iteration number as arguments in the batch file and based on that select the proper actions.

    When this information does not solve your problem, please describe your approach in detail and what is going wrong.