Jump to content
HyperSync, HyperList and FTP are now back online ×


This topic is now archived and is closed to further replies.


Batch Text Config maker (.cmd, .cfg, uae Whatever)

Recommended Posts

Some helpful Batch files and a customisable version to make all the text based config files you could ever want. lol

I knew diddly squat about batch files until recently so these are crude but extremly helpful in saving me time. (I had a little help from a friend with this. He is yet to put his name to it until reviewed!)

What it does

1. Create a text file of your chosen extension and content
2. One for ever file (rom) you have in a folder
3. Name the output files the same as the files in the folder
4. Insert the filename.ext into a specific point within the output files text

Mainly for RetroArch and Android but probably handy for other things that need a romfile name injecting to and named after

I use these to create .cmd MAME/MESS launching files, .uae Amiga launching files and .cfg RetroArch Overlay config files and override files.

One limit is that ALL files in the source folder need to have the SAME extention. Duplicate names with different extentions will cause issues in the output text files.

COPY THE TEXT between ____ lines TO NOTEPAD AND SAVE IT AS .bat

Useage Quick Steps

  1. Point the script to your folder of named files
  2. Set your fixed content text
  3. Point it to an output folder
  4. Position the romname injection point
  5. Set your output files .extension


CMD File script. (this was the original problem and the base for main script)

Used to launch MESS based systems with RetroArch MAME core on Android without the need to name your roms as the software list xml files require

**Edit the text in bold to match your local file paths, keep quotations around file paths"


@ECHO off
SET pcromfolder="INSERT YOUR file path to roms folder-example C:/ROMS/Atari 5200/"
SET shieldrompath="/storage/emulated/0/roms/Atari 5200/"
SET outpath="INSERT DISTINATION FOLDER-example C:/ROMS/CMD Launch Files"
SET sysname=a5200
SET media=-cart

CD /d %pcromfolder%
FOR %%A IN (*.*) DO (ECHO %sysname% %media% "%shieldrompath:"=%%%~nxA") >> %outpath%/%%~nA.cmd


UAE File Maker

The above batch file evolved into this one for creating .uae Amiga config files

THIS IS AN EXAMPLE FOR MY PC. The output file is below.

See these notes for further details = TextConfigMakerNotes.txt

Bold text is to highlight the main parts and user specific text


@ECHO off
SET romsfolder="E:/ROMS/4 To Sort/Commodore Amiga/[FINAL]/roms/Commodore Amiga/hdf/"
SET readromname=hardfile=read-write,32,1,2,512,/storage/emulated/0/roms/Commodore Amiga/hdf/
SET outputfolder="E:/ROMS/4 To Sort/Commodore Amiga/[FINAL]/roms/Commodore Amiga/hdf/large games/config"

SET line1=use_gui=no
SET line2=show_leds=true
SET line3=chipset=aga
SET line4=cpu_type=68ec020
SET line5=chipmem_size=4
SET line6=fastmem_size=4
SET line7=gfx_center_vertical=simple
SET line8=gfx_center_horizontal=simple
SET line9=gfx_width=640
SET line10=gfx_height=480
SET line11=sound_channels=mixed
SET line12=kickstart_rom_file=/storage/emulated/0/RetroArch/system/kick31.rom
SET line13=hardfile=read-write,32,1,2,512,/storage/emulated/0/roms/Commodore Amiga/hdf/WHDLoad.hdf

CD /d %romsfolder%
FOR %%A IN (*.*) DO (ECHO %line1% & ECHO.%line2% & ECHO.%line3% & ECHO.%line4% & ECHO.%line5% & ECHO.%line6% & ECHO.%line7% & ECHO.%line8% & ECHO.%line9% & ECHO.%line10% & ECHO.%line11% & ECHO.%line12% & ECHO.%line13% & ECHO.%readromname:"=%%%~nxA) >> %outputfolder%/%%~nA.uae


This is the output file = 1stDivisionManager_v1.0_1800.uae

hardfile=read-write,32,1,2,512,/storage/emulated/0/roms/Commodore Amiga/hdf/WHDLoad.hdf
hardfile=read-write,32,1,2,512,/storage/emulated/0/roms/Commodore Amiga/hdf/1stDivisionManager_v1.0_1800.hdf


RetroArch Overlay Override File Maker - Notes OverrideMaker.txt

So I had to play around with the location of the quotation marks in bold for the below script to give the desired output text.

I have also added the Line 1 code to make the additional text line after the override as an example of placement

You can add more lines before or after if they are static its just a case of playing around

1. ALL files in the image folder must be .png (no other files)


@ECHO off
SET romsfolder="H:/08 EMULATORS/Retroarch/Nightly 17th Feb/overlays/borders/Vectrex"
SET outputfolder="H:/08 EMULATORS/Retroarch/Nightly 17th Feb/overlays/borders/Vectrex/test"
SET readromname=:\overlays\borders\Vectrex\

SET override=input_overlay =
SET line1=additional line

CD /d %romsfolder%
FOR %%A IN (*.*) DO (ECHO %override% "%readromname:"=%%%~nxA" & ECHO. %line1%) >> %outputfolder%/%%~nA.cfg


Output Text

input_overlay =  ":\overlays\borders\Vectrex\2D_Narrow_Escape_Hack.png"
additional line


RetroArch Overlay Config File Maker

As above files I formatted this one to create a .cfg file to match all the .png overlays in a folder


@ECHO off
SET romsfolder="H:/06 PROJECTS/RA Overlay Projects/_Source Files/_System Borders/NyNy77/crushed"
SET readromname=overlay0_overlay =
SET outputfolder="H:/06 PROJECTS/RA Overlay Projects/_Source Files/_System Borders/NyNy77/crushed"

SET line1=overlays = 1
SET line2=overlay0_full_screen = true
SET line3=overlay0_descs = 0

CD /d %romsfolder%
FOR %%A IN (*.*) DO (ECHO %line1% & ECHO.%readromname:"=%%%~nxA & ECHO.%line2% & ECHO.%line3% ) >> %outputfolder%/%%~nA.cfg


Output Text

overlays = 1
overlay0_overlay = Amstrad-nyny77.png
overlay0_full_screen = true
overlay0_descs = 0


Share this post

Link to post
Share on other sites

Great job @thatman84. For the MAME core, I still need to setup the BIOS and the ini file though and point the MAME core there in addition to the rompath as specified in the setup guide? Is that correct?

Share this post

Link to post
Share on other sites
4 minutes ago, EyMannMachHin said:

Great job @thatman84. For the MAME core, I still need to setup the BIOS and the ini file though and point the MAME core there in addition to the rompath as specified in the setup guide? Is that correct?

For mame consoles you don need to specify a BIOS folder when using the command files iirc.

You have the bios zipped up with the games. So you i have a5200.zip alonside my .a52 games 

Your ini file would point to the folder containing the .cmd files 

For mame arcade games you have all the roms and bios files zipped like normal in one folder then setup a mame folder in your retroarch system/BIOS folder with with the normal mame folders for configs and what not.

Although i think retroarch mame saves its config files to the saves directory for controllers and .cfg files and nvram

Share this post

Link to post
Share on other sites
1 hour ago, thatman84 said:

@Kondorito this may help you

Thank you! I will take a look at it later on.

Share this post

Link to post
Share on other sites

I need to make a smarter config maker for an Amiga project.... I'm happy to do a manual method but wanted to explore "code" solutions before putting in the hours!

Basically I need to edit a bunch of existing .uae config files. Replacing a "varible" filename with the actual name of the current file. In two places!

Cant be done with Np++ as it cant read/insert the file name with find/replace regex. :(

Example lines I need to edit below. There are many lines of text before and after....

File name = 1000_Miglia.uae


hardfile2=rw,DH0:/storage/emulated/0/[Project_Amiga]/amiga-data/Games_HDF/1000 Miglia.hdf,32,1,2,512,0,,uae0
uaehf0=hdf,rw,DH0:/storage/emulated/0/[Project_Amiga]/amiga-data/Games_HDF/1000 Miglia.hdf,32,1,2,512,0,,uae0

Need to replace the .hdf file name with the name of the file its located in. 
Everything either side of the file name ( 1000 Miglia) needs to stay the same.


So the above example would become




Any ideas welcome

Share this post

Link to post
Share on other sites


Check this, might help you out in crafting something with notepad++ (like creating config files with only the game names inside, and batch adding the entire stuff around them with "Replace All'' by having all the documents opened at the same time):

Gotta go now, but if you can figure it out, I'll try to help you tomorrow in doing so.


Share this post

Link to post
Share on other sites
20 hours ago, thatman84 said:

@Kondorito cheers buddy. I now have a script to test out from one of the memebers here.

Will update once i have tested

hopefully no more snags ?

Share this post

Link to post
Share on other sites
1 hour ago, wallmachine said:

hopefully no more snags ?

Haha some people dont like the attention!

I will test tonight and add it to the list of helpful batch's

Thanks wallmachine

Share this post

Link to post
Share on other sites

maybe this will help i have 2 poss solutions...  

The Diff Match and Patch libraries offer robust algorithms to perform the operations required for synchronizing plain text.

  1. Diff:
    • Compare two blocks of plain text and efficiently return a list of differences.
    • Diff Demo
  2. Match:
    • Given a search string, find its best fuzzy match in a block of plain text. Weighted for both accuracy and location.
    • Match Demo
  3. Patch:
    • Apply a list of patches onto plain text. Use best-effort to apply patch even when the underlying text doesn't match.
    • Patch Demo
  4.  And maybe FART app

I use it to mass change paths in hyperspin but it should work in any search and i also uploaded the text source files that listed above

[App[licationn Source Files].rar


Share this post

Link to post
Share on other sites

@echo on
# CD %~dp0
for %%x in (ini ahk cfg xml ink lnk) do (
set extension=%%x
for /r %%a in (*.%extension%) do (
fart -i "%%a" "S:\HS" "H:\HS"

JUst change S:\HS"   to become what your looking for and then H:\HS become what you want it to be

Share this post

Link to post
Share on other sites

  • Create New...