Run A Windows Batch Program From LoadRunner VuGen

I am surprised that many people who script with LoadRunner on a regular basis do know know that you can run external programs in Windows that are kicked off by code in Vugen scripts. The system() function allows you to do this. There have been times where I needed to run a portion of a script and then kick off a program that would run on my local machine for a few minutes. I created a Windows Batch (.BAT) file with it’s own set of instructions on running and how to exit out. When I am ready to kick this BAT file off, I just put one line of code in my Vugen scripts to kick it off.

If you wanted to run a bat file called “rcmdm.bat” located in the C:\remote\ folder. In VuGen, put the following:

system("c:\\remote\\rcmdm.bat");

Pretty simple, huh? Note the additional escape character slash needed to account for the slash in the directory structure, as the slash is a special character. This is a great way to have batch jobs kicked off at specific, controlled portions of the test scenario.

What's Next?

Did you enjoy this article? Help spread the word by sharing:

Join the Northway Navigator Club today and get access to restricted content including our best tips and tricks. Membership is free! You will also receive free email updates by registering.

Engage in the conversation and leave a comment:

Scott Moore

About Scott Moore (153 articles)

With over 20 years of IT experience with various platforms and technologies, Scott has tested some of the largest applications and infrastructures in the world. He is a Certified Instructor and Certified Product Consultant in HP’s LoadRunner and Performance Center products. He currently holds HP certifications for ASE, ASC, and CI. A thought leader in the APM space, he speaks regularly at IT conferences and events



  • http://www.facebook.com/sri.vathsan Srivathsan Sundaravaradan

    Thanks for the Knowledge sharing .
    By this way can we execute a bat file present in a remote machine?
    as such

    system(“\cadope85\c$\remote\rcmdm.bat”);

    where Cadope85 is a machine in the same network as the machine with LR..