@ECHO OFF :: Check Windows version IF NOT "%OS%"=="Windows_NT" GOTO Syntax VER | FIND.EXE "Windows NT" >NUL && GOTO Syntax SETLOCAL :: Check cmmand line argument IF "%~1"=="" GOTO Syntax IF NOT "%~4"=="" GOTO Syntax IF NOT "%~3"=="" IF /I NOT "%~3"=="/D" GOTO Syntax ECHO."%~1" | FIND "/" >NUL && GOTO Syntax ECHO."%~1" | FIND "?" >NUL && GOTO Syntax ECHO."%~1" | FIND "*" >NUL && GOTO Syntax IF /I NOT "%~3"=="/D" IF NOT EXIST "%~1" GOTO Syntax SET Start=START /MIN "" IF /I "%~3"=="/D" SET START=ECHO IF EXIST "C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe" ( IF "%~2"=="" ( %Start% "C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe" "%~1" /P ) ELSE ( %Start% "C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe" "%~1" /T "%~2" ) ) ELSE ( IF EXIST "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe" ( IF "%~2"=="" ( START /WAIT REGEDIT.EXE /E "%Temp%.\_DefPrn.dat" "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows" FOR /F "tokens=2 delims==" %%A IN ('TYPE "%Temp%.\_DefPrn.dat" ^| FINDSTR.EXE /R /B /I /C:"\"Device\"="') DO ( FOR /F "delims=," %%B IN ("%%~A") DO ( %Start% "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe" /N /T "%~1" "%%~B" ) ) DEL "%Temp%.\_DefPrn.dat" ) ELSE ( %Start% "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe" /N /T "%~1" "%~2" ) ) ) :: Done GOTO End :Syntax ECHO. ECHO PrnPDF8.bat, Version 1.00 for Windows XP ECHO Prints a PDF file from the command line ECHO. ECHO Usage: PRNPDF8 pdf_file [ printer_name [ /D ] ] ECHO. ECHO Where: "pdf_file" is the file name of the PDF file to be printed ECHO "printer_name" is the name of the printer to be used (optional) ECHO /D (Debug) only displays the selected print command ECHO. ECHO Notes: Use double quotes for long file and printer names. ECHO This batch file requires Adobe Reader 8.1+ or Foxit Reader 2.3+. ECHO Foxit Reader will be used if found, otherwise Adobe Reader. ECHO If Adobe Reader is used, at least 1 Adobe Reader window will be ECHO left open, Foxit Reader will always terminate after printing. ECHO To debug the print command, use "" for the default printer. ECHO Download location Adobe Reader: ECHO http://www.adobe.com/products/acrobat/readstep2.html ECHO Download location Foxit Reader: ECHO http://www.foxitsoftware.com/pdf/reader_2/down_reader.htm ECHO. ECHO Written by Rob van der Woude ECHO http://www.robvanderwoude.com :End IF "%OS%"=="Windows_NT" ENDLOCAL