Highlighted
Absent Member.
Absent Member.
3372 views

How to verify that the .bat file is executed correctly by load runner 12.53 ?

Jump to solution

Hi All, 

I am trying to call a .bat file which is in system local / in remote system using the system() function.

 system("C:\\Users\\XXXXX\\Desktop\\new cache clear Power BI\\Clear Cache.bat");

But during execution, a black window displays and closes quickly. I think the bat file is not executing properly.

Does anyone know how to verify that the bat file is really executing through load runner or not. 

Note: same behaviour when I execute system("");  function with empty arguments. Thus I am not sure whether that the command executes bat file or not.

 I have also included "& pause" command in bat file to pause the window. But the window is paused only when we run the bat file manually not through laod runner script

Thanks,

John.

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: How to verify that the .bat file is executed correctly by load runner 12.53 ?

Jump to solution

Hi

I must have been tired when reading your problem last time, only focusing on what you wanted to test and not the problem.

So looking at the bat file you wanted to execute, it is not system() or the fact that it is a bat file that is the problem. It is the spaces in the path, that requires surrounding " (+escapechar).

So the following will work for you, if you want to avoid the extra powershell layer:

system("\"C:\\Users\\XXXXX\\Desktop\\new cache clear Power BI\\Clear Cache.bat\"");


br /ola


Please mark post as solved if your problems or questions is/are resolved.
If this post was valuable to you, please consider kudo it.

 

.

View solution in original post

5 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: How to verify that the .bat file is executed correctly by load runner 12.53 ?

Jump to solution

Hi

The obvious would be the thing you tried already, using pause.

Next step would be to write to a file and check the file afterwards.

echo Hello >> c:\temp\vugen_log.txt
echo Hello again >> c:\temp\vugen_log.txt

If it is more permamnent and you need to have this while executing scenarios, you may need to create unique filenames and pass them to the .bat file to keep the content understandable.

echo unique file >> c:\temp\vugen_log_%1.txt



br /ola


Please mark post as solved if your problems or questions is/are resolved.
If this post was valuable to you, please consider kudo it.

.
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: How to verify that the .bat file is executed correctly by load runner 12.53 ?

Jump to solution

Hi John,

To run your batch fle successfully, please try to use "start" command, but be aware it requires to specify window name and all quotes should be escaped by "\" symbol. Something like this:

system("start \"ClearCache\" \"C:\\Users\\XXXXX\\Desktop\\new cache clear Power BI\\Clear Cache.bat\"");

Regards,

Mikhail

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: How to verify that the .bat file is executed correctly by load runner 12.53 ?

Jump to solution

Hi All,

My vugen script was not actually executing the file for some reason, thats why i was getting a black window which pops up and closes quickly (same behviour can be observered when we execute the system function without any values                     Eg: system(" ");  )

I approached a different way by calling the powershell.exe directly and executing the script, Instead of calling the powershell through bat file.

system("C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -executionpolicy bypass -File \"C:\\Users\\******\\Desktop\\new cache clear Power BI\\QA-ClearCache.ps1\"");

 

Thanks,

John. 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: How to verify that the .bat file is executed correctly by load runner 12.53 ?

Jump to solution

Hi

I must have been tired when reading your problem last time, only focusing on what you wanted to test and not the problem.

So looking at the bat file you wanted to execute, it is not system() or the fact that it is a bat file that is the problem. It is the spaces in the path, that requires surrounding " (+escapechar).

So the following will work for you, if you want to avoid the extra powershell layer:

system("\"C:\\Users\\XXXXX\\Desktop\\new cache clear Power BI\\Clear Cache.bat\"");


br /ola


Please mark post as solved if your problems or questions is/are resolved.
If this post was valuable to you, please consider kudo it.

 

.

View solution in original post

Highlighted
Absent Member.
Absent Member.

Re: How to verify that the .bat file is executed correctly by load runner 12.53 ?

Jump to solution

Hi,

Can you please let me know how to verify the same when the script is running in load generator through controller? 

Approach i followed :

I have copied the files to load generator and providing the load generator local path in the script  

Local vugen script : 

system("\"C:\\Users\\{ my desktop user name}\\Desktop\\new cache clear Power BI\\Clear Cache.bat\"");

PC vugen script : 

system("\"C:\\Users\\{the LG system name}\\Desktop\\new cache clear Power BI\\Clear Cache.bat\"");

is the above way of wiritng the system function is correct to make the bat file execute? 

 

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.