Advertisement
anonit

Convert FLAC to MP3

Nov 23rd, 2012
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 2.09 KB | None | 0 0
  1. @echo off
  2.  
  3. :: Batch converts FLAC files to MP3
  4. ::
  5. ::
  6. :: Requires:
  7. :: Lame - http://lame.sourceforge.net/index.php
  8. :: FLAC - http://sourceforge.net/projects/flac/
  9. ::
  10. :: Usage:
  11. :: convertFLAC.bat %%LOCATION_OF_FLAC_FILES%%
  12. ::
  13. :: eg:
  14. :: convertFLAC.bat c:\flac
  15. :: convertFLAC.bat %%USERPROFILE%%\desktop\flac
  16. ::
  17.  
  18.  
  19.  
  20.  
  21. :: Set the FLAC file path below
  22. ::
  23.  
  24. set FLACPROGRAM="c:\program files (x86)\flac\flac.exe"
  25.  
  26. ::
  27. :: set the LAME file path below
  28. ::
  29.  
  30. set LAMEPROGRAM="c:\program files (x86)\lame for audacity\lame.exe"
  31.  
  32. ::
  33. :: +-----------------------------+
  34. :: | DO NOT EDIT BELOW THIS LINE |
  35. :: +-----------------------------+
  36. ::
  37.  
  38.  
  39. if [%1]==[] goto :VARNOTDEFINIED
  40. if [%1] NEQ [] set SOURCEPATH=%1
  41.  
  42.  
  43. if not exist %FLACPROGRAM% goto :FLACNOTFOUND
  44. if not exist %LAMEPROGRAM% goto :LAMENOTFOUND
  45.  
  46. set CURRENTLOCATION=%CD%
  47. set TEMPFILE=%TEMP%\flac_convert_%random%.tmp
  48. cd /d %SOURCEPATH%
  49.  
  50.  
  51. dir/b %SOURCEPATH%\*.flac > %TEMPFILE%
  52. for /f "delims=*" %%G in (%TEMPFILE%) do call %FLACPROGRAM% -d "%%G"
  53.  
  54. dir/b %SOURCEPATH%\*.wav > %TEMPFILE%
  55. for /f "delims=*" %%G in (%TEMPFILE%) do call %LAMEPROGRAM% "%%G"
  56.  
  57. goto :FINISHED
  58.  
  59.  
  60. :VARNOTDEFINIED
  61. echo.
  62. echo Batch convert flac to mp3
  63. echo.
  64. echo Requires:
  65. echo Lame - http://lame.sourceforge.net/index.php
  66. echo FLAC - http://sourceforge.net/projects/flac/
  67. echo.
  68. echo Usage:
  69. echo convertFLAC.bat %%LOCATION_OF_FLAC_FILES%%
  70. echo.
  71. echo eg:
  72. echo convertFLAC.bat c:\flac
  73. echo convertFLAC.bat %%USERPROFILE%%\desktop\flac
  74. echo.
  75.  
  76. goto :FINISHED
  77.  
  78. :FLACNOTFOUND
  79. echo.
  80. echo ERROR FLAC NOT FOUND
  81. echo.
  82. echo FLAC was expected at %FLACPROGRAM%
  83. echo FLAC can be downloaded at http://sourceforge.net/projects/flac/
  84. echo Download and install FLAC.
  85. echo Edit the batch file and update the path.
  86. echo.
  87.  
  88. goto :FINISHED
  89.  
  90. :LAMENOTFOUND
  91. echo.
  92. echo ERROR LAME NOT FOUND
  93. echo.
  94. echo LAME was expected at %LAMEPROGRAM%
  95. echo LAME can be downloaded at http://lame.sourceforge.net/index.php
  96. echo Download and install LAME.
  97. echo Edit the batch file and update the path.
  98. echo.
  99.  
  100. goto :FINISHED
  101.  
  102. :FINISHED
  103. erase %TEMPFILE%
  104. cd /d %CURRENTLOCATION%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement