Organize, Compress, and Clean your ISO/BIN/CUE Rom Library with Chdify.

🧩 CHDify: Automate CHD Conversion with a Simple Windows Batch Script

If you’ve ever managed a large collection of disc-based games or media, you know how much space those raw image files can eat up — Especially when you have multiple CUE/BIN files for a single game  and how tedious it is to manually convert them to CHD format one by one. Especially when you have multiple CUE/BIN files for a single game

 

That’s why I built CHDify, a lightweight Windows batch script that automates the process using chdman — the same tool used by MAME for compressing disc and ROM images, and 7za free and easy to use archive and compression tool.

 

CHDify scans a directory, identifies compatible files, and converts them to .chd with a single command. No questions — just a fast, reliable workflow that works anywhere Windows does.

💡 What CHDify Does

CHDify is designed to make batch CHD creation completely hands-off. Here’s a quick overview of what it can do:

 

  • 🔁 Automates conversion — Loops through all .cue, .iso, or .bin files in a directory and processes them automatically.

  • ⚙️ Supports multiple modes — Choose between createcd and createdvd modes depending on your image type.

  • 🧠 Smart re-runs — Skips already converted .chd files, so you can safely run it multiple times.

  • 🪶 Lightweight & portable — It’s just a .bat file — no installation or external dependencies required.

🧰 How It Works

At its core, CHDify uses a configurable mode, createcd & createdvd, to process files based on what platform they are for, createcd being for PS1, PS2, etc, and createdvd for PSP isos as their emulators can be a bit more finiky.

From there, it scans your chosen folder, identifies image files, and uses 7z to decompress if necessary, and chdman to  generate matching .chd versions — logging everything to the console as it goes

 

It also cleans up after itself, removing any .txt files left behind as well as the old 7z/archive file, and the ISO, leaving only a .CHD file in their place along with a .m3u file if apllicable and setup correctly.

Safety First!

I typically wouldn’t recommend running code you found on the internet without understanding it. I’ll have the entire contents of the .bat file at the end of this post if you want to read through, or make the .bat file yourself instead of trusting a download. However, for those that find it more convenient I also have the files available here and on my new GitHub. Download Links for everything below, 

 

Chdify GitHub:  https://github.com/Senti-Mentel/chdify 

7z: https://www.7-zip.org/

MAME(which inludes chdman, but is also included in my github dl): https://www.mamedev.org/release.html

 

This .bat file does several things in this order:

  • ✅ Automatically extracts .zip and .7z archives
  • ✅ Recursively deletes unwanted .txt and .m3u files to avoid creating duplicates later
  • ✅ Converts .cue.bin, and .iso files to .chd using chdman
  • ✅ Detects and processes multi-disc games (e.g. (Disc 1)(Disc 2) naming)
  • ✅ Generates .m3u playlists for multi-disc games within their own subfolder
  • ✅ Cleans up original disc image and archive files after conversion

⚠️ Disclaimer

**This script permanently deletes .7z, .iso, .cue, and .bin files after successful conversion. Make sure you have backups or confirm the CHD output before deleting originals.

Use at your own risk.**

🚀 Getting Started

There is just a little bit of setup you want to do before running the script. This .bat file is looking for a specific folder and file structure. We need a main directory, with at least subfolders for multi disc games like the “before” example below. 

You can have single disc games files in the root or in a subfolder, but you’ll definitely want multidisc games in their own folder to benefit from the auto generation of m3u files. 

Before:

Roms/
├── PS1/
    ├── Final Fantasy IX/
        ├── Final Fantasy IX (Disc 1).7z
        ├── Final Fantasy IX (Disc 2).zip
        ├── Final Fantasy IX (Disc 3).7z
        └── Final Fantasy IX (Disc 4).zip
    └── Harvest Moon - Back to Nature.iso
    ├── Final Fantasy VII/
        ├── Final Fantasy VII (Disc 1).bin
        ├── Final Fantasy VII (Disc 1).cue
└── PS2/
    ├── Shadow of the Colossus.iso
    ├── Metal Gear Solid 3 Subsistence/
        ├── Metal Gear Solid 3 Subsistence (Disc 1).iso

After:

Roms/
├── PS1/
    ├── Final Fantasy IX/
        ├── Final Fantasy IX.m3u
        ├── Final Fantasy IX (Disc 1).chd
        ├── Final Fantasy IX (Disc 2).chd
        ├── Final Fantasy IX (Disc 3).chd
        └── Final Fantasy IX (Disc 4).chd
    └── Harvest Moon - Back to Nature.chd
    ├── Final Fantasy VII/
        ├── Final Fantasy VII (Disc 1).chd
        ├── Final Fantasy VII (Disc 2).chd
└── PS2/
    ├── Shadow of the Colossus.chd
    ├── Metal Gear Solid 3 Subsistence/
        ├── Metal Gear Solid 3 Subsistence.m3u
        ├── Metal Gear Solid 3 Subsistence (Disc 1).chd

Once you have that and the associated files your ready to go:

  • The chdify.bat,chdman.exe, and 7z.exe files need to be in the root directory.
  • Multi disc game files need to be in their own sub folder
  • If converting PSP games, open chidify-1.4.bat and set the below accordingly:
    set MODE=createcd
    
    Change to createcd or createdvd depending on the media type.
  • Double click the chdify.bat file to run the script, the current process and output will be displayed in the command prompt terminal that opens up.
  • That’s it! Just let the script run and watch your iso or cue/bin rom library get cleaned organized and compressed all at once. 

The .bat

Everything you need including 7z, chdman, and chdify are included in my github download above, but if you want to take a look at the code, or make the .bat file and source the executables yourself, heres the scripts itself. To make the bat file yourself just paste the below code into a txt file and rename it to .bat. Then double click to run.

@echo off
setlocal EnableDelayedExpansion

:: === CONFIGURATION ===
:: Set conversion mode: createcd or createdvd
set MODE=createcd

:: Path to chdman (set this if chdman isn't in PATH)
set CHDMAN=chdman.exe

:: Path to 7z (set this if 7z.exe isn't in PATH)
set SEVENZ=7z.exe

echo -------------------------------
echo Game Processing Script Started
echo Mode: %MODE%
echo -------------------------------

:: STEP 1: Unzip all .zip and .7z files
echo Extracting archives...
for %%f in (*.zip *.7z) do (
    echo Extracting: %%f
    "%SEVENZ%" x "%%f" -o"%%~nf" >nul
)

:: STEP 2: Delete all .txt and .m3u files
echo Deleting .txt and .m3u files...
for /R %%f in (*.txt *.m3u) do (
    del /f /q "%%f"
)

:: STEP 3: Convert remaining ISO/CUE/BIN files to CHD
echo Converting remaining disc images to CHD...
for /R %%f in (*.iso *.cue) do (
    set "chd=%%~dpnf.chd"
    if not exist "!chd!" (
        echo Converting: %%f
        "%CHDMAN%" %MODE% -i "%%f" -o "!chd!"
    )
)

:: STEP 4: Process subfolders for multi-disc games
echo Deleting all existing .m3u files...
for /r %%f in (*.m3u) do (
    echo Deleting "%%f"
    del "%%f"
)

echo Scanning for folders with multiple .chd files...

for /d /r %%d in (*) do (
    set "chd_count=0"
    set "first_file="
    set "folder=%%d"

    REM Count CHD files and capture the first filename
    for %%c in ("%%d\*.chd") do (
        if exist "%%c" (
            set /a chd_count+=1
            if not defined first_file (
                set "first_file=%%~nxc"
            )
        )
    )

    if !chd_count! GEQ 2 (
        REM Clean the name of the first file (remove (Disc 1) and extension)
        set "playlist_name=!first_file:(Disc 1)=!"
        set "playlist_name=!playlist_name:.chd=!"
        set "playlist_path=%%d\!playlist_name!.m3u"

        echo Creating playlist: !playlist_path!

        (
            for %%c in ("%%d\*.chd") do (
                echo %%~nxc
            )
        ) > "!playlist_path!"
    )
)

:: STEP 5: Delete all .7z, .iso, .cue, and .bin files
echo Step 5: Cleaning up .7z, .iso, .cue, and .bin files...

for /R %%f in (*.7z *.iso *.cue *.bin) do (
    echo Deleting: %%f
    del /f /q "%%f"
)

    endlocal
    popd >nul
)

echo -------------------------------
echo Processing Complete
echo -------------------------------
pause

Related Articles

Verified by MonsterInsights