Code for batch file processing and batch file generation with reduced noise