Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run batch file(.bat) from Jmeter

I'm new to Work with jmeter and I want to run batch file ,I have tried to run batch file from BSF sampler using this command

exec("C:\Windows\System32\wscript.exe../stopwas.bat")

and it displayed an error message

"there is no script engine for file extension .bat"

  • also I have tried to run batch file from OS process sampler and I wrote the command as :

    command :cmd
    stopwas.bat 
    

also it failed can anyone help me with this issue?

like image 433
marwa saif Avatar asked Oct 18 '25 03:10

marwa saif


1 Answers

For OS Process Sampler I guess you need to provide a command parameter like /c or /k.

So:

  • Command: cmd
  • Command parameters:
    • /c
    • c:\somefolder\someotherfolder\stopwas.bat

Mention that you have to use full path to your .bat file.

Another option is executing it via Beanshell Sampler

Runtime.getRuntime().exec("C:/Windows/System32/cmd.exe /c c:/somefolder/someotherfolder/stopwas.bat");
like image 180
Dmitri T Avatar answered Oct 20 '25 10:10

Dmitri T



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!