Batch Files for FLAC


Note that this was done on my WinXP machine, and may vary on Win95/98/ME boxes. The first thing I suggest doing is reading up about FLAC, as I don't have the knowledge of it that I do .shn and don't yet feel comfortable writing an FAQ about it. Here are a few of my top suggestions:

Flac Project Page

Etree Wiki FLAC FAQ

Etree Wiki FLAC Frontend FAQ

Flac Frontend Download Page (with mirror of FLAC Frontend FAQ, Im not sure if it was an Etree Wiki or a Mike Wren written FAQ first, whichever can feel free to contact me and I will gladly give proper credit. We're all just trying to help out eh?)

Now that you've read all of that....

The first thing you need is flac.exe and metaflac.exe installed on your computer. I have them stored in c:\windows\flac. If you put them somewhere else you'll need to alter these files to show that. If you used Jeremy's method for shn files then you should already have a directory called c:\util on your drive. If not, Id suggest creating it. I would also suggest creating c:\burning if you havent already. This will be the output folder for your .wav files so that you can burn them to audio cdr.

Within c:\util make these .bat files. (If you dont know how to create .bat files... well, just create a .txt file but name it .bat instead.)

@echo off
cls
for %%f in (*.wav) do c:\windows\flac\flac.exe -e %%f (*.wav)
pause

Name that file "makeflac.bat." Then create this .bat file:

@echo off
cls
for %%f in (*.flac) do c:\windows\flac\flac.exe -d -o "c:\burning\%%f.wav" %%f
pause

Name this file "unflac.bat." Then create this file:

@echo off
cls
for %%f in (*.flac) do c:\windows\flac\flac.exe -t %%f
pause

Name that file "testflac.bat." Then make this file:

@echo off
cls
for %%f in (*.flac) do c:\windows\flac\metaflac.exe %%f --with-filename --show-md5sum >>~nameme~.ffp.txt
pause

Name it "showfpf.bat" ("fpf" stands for "fingerprint file.")

Now you need to find your "folder options." In WinXP if you open a Windows Explorer window you will see a button called "Tools." If you click "Tools" you will then see "Folder Options." Within "Folder Options" you will see 3 tabs. "General," "View," and "File Types." Go to the "File Types" tab, and browse down to "Flac." If "Flac" isn't one of your filetypes then select "New" and create it. Once you select flac as your file type you will see the "Advanced" button below. Click that and a new box will pop up, then select "New" to create a new action for flac files. Call your first new action "Extract." Where it says "Application used to perform action" put in "c:\windows\flac\flac.exe" -d "%1" "%1.wav" WITH the quotes. (Note: if you didnt install flac.exe to c:\windows\flac you will need to edit that to point to the location of flac.exe.) After you've entered this you can click "OK." The box will disappear and you'll be back in your "File types" tab, and "Extract" should now be in the window that shows actions for flac files. I would also set this to the default.

Now do the same, click "Advanced" and go to create another new action for .flac files. Call this one "Extract All" and browse to your "unflac.bat" for the application used to perform the action.

Create another new action for flac files, and call it "Show Fingerprint File." Browse to your showfpf.bat file and select it for the application used to perform the action. Click "OK" again, and it should take you back out to your "File Types" tab.

Create another new action for flac files and call it "Test Flac." Browse to your "testflac.bat" and select it for the application used to perform the action.

Browse down to .wav file and create an action called "Compress to FLAC" and enter "c:\windows\flac\flac.exe" -e "%1" WITH the quotes as the application to perform the action.

Create another action called "Compress All To FLAC" and browse to your "makeflac.bat" and select it as the application to perform the action.

Now that thats all finished heres what you should be able to do:

1. Right click on any FLAC file and select "Extract" and have a .wav file be created in the same directory.

2. Right click on any FLAC file and select "Extract All" and have all of the resulting .wav files end up in c:\burning (or wherever you directed them to in your unflac.bat.

3. Right click on any FLAC file and select "Fingerprint File" and have a txt file created in the directory with the flac md5s.

4. Right Click on any FLAC file and select "Test FLAC" and have it test your flac file in a DOS window. This is handy to check that you burned the files correctly to a disc or that they transferred to another directory successfully.

5. Right click on any .wav file and select "Compress to FLAC" and have a FLAC file for that .wav file end up in the same directory.

6. Right click on any .wav file and select "Compress All to FLAC" and have all the .wav files be made to .flac and kept in that directory.


Now go download some FLAC filesets and check it out!


Special thanks to Josh Coalson; the creator of FLAC. Mike Wren; for his pages about the flac frontend and for serving it out on his server. wiki.etree.org; for their helpful FAQ about and the flac fingerprint files, and flac FAQ in general. I also could not have figured this out without first doing it for .shn files, so thanks again to Jeremy Clark.

Look for FLAC files soon on FurthurNET!

Back to Main Page

Back to MKW Guide

Win95/98/ME Batch Files

WinXP Batch Files

Links Page