I am running some jmeter tests through command line, and in that command I have the statement:

-l testresults.jtl

which of course outputs the jmeter results into a file that is called "testresults". My question is:

Is there a way in command line to give a unique name to the test results file?

I would like to append the name of the test, along with a time stamp in order to keep it unique.

  • are you executing the command manually or do you do it via a script? Commented Dec 14, 2016 at 2:47
  • executing via command line, manually
    – DEnumber50
    Commented Dec 14, 2016 at 20:21
  • Well then you will be typing in the command, so you can give any name of your choice to the JTL file. If you want to make it unique use incremental numbers in combination to the textual name you have thought for the results. For example, results1.jtl, results2.jtl Commented Dec 15, 2016 at 2:46
  • Right, i'm aware of this. Essentially I am trying to reduce the amount of changing in the command, by injecting some form of variable. So that I don't need to edit the output file every time.
    – DEnumber50
    Commented Dec 15, 2016 at 18:48

3 Answers 3


On a Windows based system,

Open notepad and write the below piece of code in it.

C:\ set SAVESTAMP=%DATE:/=-%@%TIME::=-%

jmeter -n -t "Your .jmx file path" -l %SAVESTAMP%

Now save this as a batch cript - filename.bat

Go to the location where you saved your file and run it by double-click or select and enter.

This should do the trick for you.

On Linux based system you might want to run it with a similar shell script.


JMeter-only solution:

  1. Add a Listener of your choice to the test plan and configure to store it whatever you want in a file.
  2. Use __time() function as a part of file name to make current timestamp a part of it

Non-JMeter solution

Your question itself is not very related to JMeter, you can pass whatever you want via -l parameter and JMeter tries to store test results in that location, so few ideas on getting timestamps:


JMeter Command Line Timestamp Demp

For more information on different ways of launching JMeter tests without using GUI check out Five Ways To Launch a JMeter Test without Using the JMeter GUI article

  • So I am on a windows 7 machine running these scripts, listeners don't work because I am using distributed machines. How is it possible to use windows powershell to input the date/time into the file name in command line?
    – DEnumber50
    Commented Dec 14, 2016 at 22:44
  • The answer is above: Get-Date -UFormat "%s", if you need different format refer to Get-Date documentation
    – Dmitri T
    Commented Dec 15, 2016 at 5:15
  • Placing the above answer into cmd gets an error
    – DEnumber50
    Commented Dec 15, 2016 at 18:46

Use the below, predefined, property of JMETER to parameterize the file name.


It gives a unique result file name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.