How to run batch file(.bat) from Jmeter

拟墨画扇 提交于 2021-01-27 16:58:04

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/22302665/how-to-run-batch-file-bat-from-jmeter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!