Run A Windows Batch Program From LoadRunner VuGen
Posted on Aug, 2012 by Admin
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:
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.