Skip to content
Matt Nadareski edited this page Sep 19, 2025 · 3 revisions

Batch Running

Flags: -bt, --batch

Run a special mode that takes input files as lists of batch commands to run sequentially. Each command has to be its own line and must be followed by a semicolon (;). Commented lines may start with either REM or #. Multiple batch files are allowed but they will be run independently from each other.

The following commands are currently implemented:

Description Command and Arguments Notes
Set a header field (if default) set(header.field, value);
Parse new file(s) input(datpath, ...); Each datpath needs to be either a file or folder containing files.
Perform a dir2dat d2d(path, ...); Each path needs to be either a file or folder containing files.
Filter on a field and value filter(field, value, [remove, [perMachine]]); The field needs to be either an item field (in the form item.fieldname) or a game/machine field (in the form game.fieldname or machine.fieldname).
remove is an optional value that instructs the filter to omit items that match this field and value when set to true.remove defaults to false if not set.
perMachine is an optional value that instructs the filter to remove any machine where at least one item fails the filter. perMachine requires remove to be explicitly set and defaults to false if not set.
Apply a MAME Extra INI for a field extra(field, inipath); The field needs to be either an item field (in the form item.fieldname) or a game/machine field (in the form game.fieldname or machine.fieldname). The path needs to be a file.
Perform a split/merge merge(mergetype); The mergetype needs to be one of the following: split, merged, nonmerged, full, or device.
Set game names from description descname();
Run 1G1R on the items 1g1r(region, ...); Regions are case-insensitive.
Split into one rom per game orpg();
Remove fields from games/items remove(field, ...); The field needs to be either an item field (in the form item.fieldname) or a game/machine field (in the form game.fieldname or machine.fieldname).
Remove scene dates from names sds();
Add new output format(s) format(datformat, ...); Each datformat must be a recognized string, similar to the --dat-format flag for Update.
Set the output directory output(outdir); outdir does not need to exist prior to setting. If it does not exist, it will be created on write.
Write the internal items write([overwrite]); overwrite is an optional value that instructs the writer to overwrite any existing files with the same name when set to true. overwrite defaults to false, if not set.
Reset the internal state reset();

Examples

Read a file in, set an output directory, filter to games with Europe in the name, and then write out.

REM Add input
input("path\to\dat.xml");

REM Set output dir
output("path\to\output");

REM Filter out anything that has a game name with "Europe"
filter(machine.name, "^.*?\(.*Europe.*\)$", true);

REM Write out the file
write();

REM Reset the internal state (unnecessary since this is the last step)
reset();

Filter out games with the cloneof tag and write to a new filename

REM Set output filename
set (header.filename, "NewFilename.xml");

REM Add input
input("path\to\dat.xml");

REM Set output dir
output("path\to\output");

REM Filter out anything that includes a cloneof tag
filter("machine.cloneof", ".+", true);

REM Write out the file
write();

Filter to games that only support 4 players and only write out Roms

REM Add input
input("path\to\dat.xml");

REM Set output dir
output("path\to\output");

REM Filter out anything that isn't set to 4 players at the game level
filter("item.players", "4", false, true);

REM Filter out anything but Roms
filter("item.type", "rom");

REM Write out the file
write();

Clone this wiki locally