如何从Jmeter运行批处理文件(.bat) [英] How to run batch file(.bat) from Jmeter

查看:685
本文介绍了如何从Jmeter运行批处理文件(.bat)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用jmeter的新手,我想运行批处理文件,我尝试使用此命令从BSF采样器运行批处理文件

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

它显示了一条错误消息

没有文件扩展名.bat的脚本引擎"

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

  • 我也尝试从OS进程采样器运行批处理文件,并将命令写为:

  • 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?

推荐答案

对于OS Process Sampler,我想您需要提供诸如/c/k的命令参数.

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

所以:

  • 命令:cmd
  • 命令参数:
    • /c
    • c:\somefolder\someotherfolder\stopwas.bat
    • Command: cmd
    • Command parameters:
      • /c
      • c:\somefolder\someotherfolder\stopwas.bat

      提到您必须对.bat文件使用完整路径.

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

      另一个选项是通过 Beanshell采样器 执行

      Another option is executing it via Beanshell Sampler

      Runtime.getRuntime().exec("C:/Windows/System32/cmd.exe /c c:/somefolder/someotherfolder/stopwas.bat");
      

      这篇关于如何从Jmeter运行批处理文件(.bat)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆