marwa saif
marwa saif

Reputation: 59

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 it failed can anyone help me with this issue?

Upvotes: 4

Views: 11872

Answers (1)

Dmitri T
Dmitri T

Reputation: 168072

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");

Upvotes: 4

Related Questions