问题
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