Useful Batch Files

From vgmrips

This is a more advanced "tutorial" which is more of a cache of helpful .bat files. Comfort with use of these files is assumed.

See also "Some useful scripts for making VGM packs", and Kaijuu, the Windows BAT File Butler.

Note: For most of the VGM Tools, you can specify an output file: tool.exe "input.vgm" "output.vgm"

all2txt

FOR %%A IN (*.vg?) DO vgm2txt "%%A" 0 0

Ubuntu form:

for f in *.vg? ; do vgm2txt "$f" 0 0 ; done

find_start_points

Like all2txt, but is more convenient when all you need is to find the beginning trims.

.bat form:

FOR %%A IN (*.vg*) DO vgm2txt "%%A" 0 0:03

Command line form:

FOR %A IN (*.vg*) DO vgm2txt "%A" 0 0:03

Ubuntu form:

for f in *.vg? ; do vgm2txt "$f" 0 0:03 ; done

change_system (and other quick vgm_tag changers)

If you commonly need to change only the System part of many VGM tags, you can make .bats like these examples. Any of the vgm_tag short names can be used.

FOR %A IN (*.vg*) DO vgm_tag -System:SMD "%A"
for %f in (*.vg?) do vgm_tag -System:Arc "%f"

With simple changes, you can do the same for any field:

for %f in (*.vg?) do vgm_tag -Creator:"Alex Kidd" "%f"

opt

for %%f in (*_trimmed.vgm) do optvgm "%%f" "%%~nf.vgz" & vgm_cmp "%%~nf.vgz" & gzip.exe "%%~nf_optimized.vgm" & ren "%%~nf_optimized.vgm.gz" "%%~nf_optimized.vgz"

clean_names_and_get_stats

Usage assumptions:

  • vgm_name can be reached.
  • The folder this is used in/on only contains VGMs meant to go in the playlist.
  • (For best results) The folder is named the correct name for the pack.
echo off
vgm_name
dir *.vg? /b /on > "playlist.m3u"
vgm_stat playlist.m3u > stats.txt
for %%* in (.) do move "playlist.m3u" "%%~n*.m3u"
pause
Note: To get track stats in the proper form, using a playlist is required.
Note: Used in a .bat file, move wallops existing files rather than ignores them, much to the dismay of DeadFish and anyone else with sense. (You can't avoid this behavior with a single simple line.) At least in this case it doesn't matter.