Looping through settings in CellProfiler batch mode

Dear CellProfiler Pros,

I’m trying to write a script to loop through different settings for thresholding in my CellProfiler pipeline. Any chance you could let me know what would be the best option?

E.g. I can manually create few batch files and then run them through shell script as a loop. This of course is way too slow. Is there a way to modify batch (.h5) files directly?

Ideally I’d like to be able to pass a variable to the batch file and then run it. However I’m not sure how to do it.

Thanks for your patience and time!