No idea honestly, i’m simply offering some suggestions..
If this a process you want automated i would suggest taking a further look at Cron processing, even if it means dividing the overall task into several smaller ones (that could help with timeout issues – maybe?).
About as close as i’ve been to batch processing is writing the odd .bat file on windows to open up my apps or run a defrag, so i’m not speaking from experience.
I’m not sure your question is nessarily specific to WordPress, the only element that makes this about WordPress is the fact you’re performing operations on data in the WordPress database, but i don’t think that means you necessarily need exclude other batch scripts as possibilities. I think the WP cron functions are the way to go personally, but it’s not really something i’ve had experience with myself.
Your question might be better suited posted on one of the following mailing lists.
https://codex.www.ads-software.com/Mailing_Lists#Hackers
https://codex.www.ads-software.com/Mailing_Lists#Professional
I’ll move your thread to the Advanced forum later today, this seems a little bit outside the scope of the regular “how do i do this on the blog” questions that typically reside in this forum. I’ll let the thread have a little life here first though, then move it onto the Advanced section.