@echo off SetLocal EnableDelayedExpansion set TIFF2PDF="%programfiles%\gnuWin32\bin\tiff2pdf.exe" set TIFFCP="%programfiles%\gnuWin32\bin\tiffcp.exe" set TMPTIF=tmp.tif set INPUT=%1 set OUTPUT=%2 goto start :help echo Tiff2PDF by HM2K (Updated: 22/10/09) echo Combines and converts TIF files to a PDF file, sorted by name. echo. echo Usage: tiff2pdf [image file/dir] [output.pdf] :required echo @required: http://gnuwin32.sourceforge.net/downlinks/tiff.php goto end :start if %2()==() goto help if %2==/? goto help if %2==? goto help if not exist %TIFF2PDF% goto required if not exist %TIFFCP% goto required :filecheck if not exist %1 echo File '%1' does not exist. && goto end :dircheck REM is is a dir? if not exist %1\NUL goto run :loopdir set FILES= FOR /f "tokens=*" %%i IN ('dir /b /O:N %1\*.tif') DO set FILES=!FILES! "%1\%%i" :combine %TIFFCP% -c none %FILES% %TMPTIF% set INPUT=%TMPTIF% :run %TIFF2PDF% -o %OUTPUT% %INPUT% if exist %OUTPUT% echo done. goto end :end if exist %TMPTIF% del/f/a %TMPTIF%