1. SPEForums need your contributions to build up a strong repository of performance engineering resources.

    Dismiss Notice
  2. Whatsapp Group For Software Performance Engineering Professionals!! Click here to get added . No Spam for strictly professional discussions only.
    Dismiss Notice
Dismiss Notice
Hello Guest,

Please reach out to us at admin@speforums.com/+91 8600177662 in case you face any issues with SPEForums. Share your feedback - Click Here

Please support us by sharing performance engineering tutorials/resources with SPEForums.com

-Crew

System Command Example In Loadrunner 2017-12-05

Making a command line (CMD) call through loadrunner

  1. admin
    Attached is the sample loadrunner file

    Example Description

    In this example we are doing following activities via a loadrunner script

    1. Create a direcotry named speforums in your C drive.
    2. Execute a ping command and save it as a file inside c://speforums directory.


    Sample code


    Code:
        char filename[1024], command[1024];
      
        //define directory name
        char new_dir[] = "C:\\speforums";
      
        // Create a directory under root called xyz and make it the current dir
        if (mkdir(new_dir))
            lr_output_message ("Create directory %s failed", new_dir);
        else
            lr_output_message ("Created new directory %s", new_dir);
      
        //Define a filename
        sprintf(filename, "%s\\%s", new_dir, "pingfile_speforums.txt");
      
      
        // Execute a ping command and direct it to a new file
        sprintf(command, "ping speforums.com >> %s", filename);
        system(command);
        lr_output_message ("Created new file %s", filename);
    Attached is the working script file.

    Final Output:

    upload_2017-12-5_23-12-2.png

    Contents of the file:

    upload_2017-12-5_23-13-5.png

    Images

    1. upload_2017-12-5_23-13-8.png