Batch processing, variable outputfile names

I’ pretty new using SNAP software and currently Im using version 7.
I am trying to run a simple math between the bands of multiple images from Sentinel 2. I create a graph which and use a couple of “Mathband” operators and put an output for each of them using the write operator (refer to the attached file TEST-wb1.xml (3.5 KB) ). There is no issue till here.
However, As I run the process in batch mode, using the batch processes, the output files are overwritten. Perhaps because I don’t know how to add suffix/prefix to the output file names to get updated for each iteration.
I tried to use “targetBasePath” as it was mentioned in other posts, but I couldn’t correct implement it.
Not that: selecting “keep source product names” would work if I had only one bandmath operators. But since I have a couple of them the outputfiles will be overwritten on each other.

To update my question, I started using the gpt command line, but still not sure how to add variable output filenames, is there any particular command that we can add in gpt or in the xml file to generate the outputs with the names same as input files+sufix/prefix?

Usually the gpt command line offers the possibility of writing a target name, the format is:

gpt filename-xml -S nameofinputfile.dim -t nameoftargetfile.dim (it changes depending on the function)

To work in batch mode, you will need to write on a text file the gpt order with all you input an output names and save as .bat (windows) o .sh (linux) to run the process. I am sure there are examples already written in the forum.

Thank you but what’s the point of writing all output file names?! I needed to automate things not to provide every single output filenames…and I could not find any example, that’s why I opened this topic…

You could do that while preparing your bat/sh file, for instance in Excel, copying the name of the input file and add a suffix or prefix.

I would be grateful if you could elaborate me on how to create a .bat file.

Do you mean create a text file with all the input file names followed by (coma or tab) output file names and then save it as a .bat file?

Once we create the above .bat file, how do you open that file in Batch processing window?

Have you seen this page?
A bat example is given together with extensive instructions.