(view source code of prnpdf9.bat as plain text)
@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 "%ProgramFiles%\Foxit Software\Foxit Reader\Foxit Reader.exe" (
IF "%~2"=="" (
%Start% "%ProgramFiles%\Foxit Software\Foxit Reader\Foxit Reader.exe" /p "%~1"
) ELSE (
%Start% "%ProgramFiles%\Foxit Software\Foxit Reader\Foxit Reader.exe" /t "%~1" "%~2"
)
) ELSE (
IF EXIST "%ProgramFiles%\Adobe\Reader 9.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% "%ProgramFiles%\Adobe\Reader 9.0\Reader\AcroRd32.exe" /N /T "%~1" "%%~B"
)
)
DEL "%Temp%.\_DefPrn.dat"
) ELSE (
%Start% "%ProgramFiles%\Adobe\Reader 9.0\Reader\AcroRd32.exe" /N /T "%~1" "%~2"
)
)
)
:: Done
GOTO End
:Syntax
ECHO.
ECHO PrnPDF9.bat, Version 1.00 for Windows XP
ECHO Prints a PDF file from the command line
ECHO.
ECHO Usage: PRNPDF9 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 9.0+ or Foxit Reader 3.0+.
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://get.adobe.com/reader/
ECHO Download location Foxit Reader:
ECHO http://www.foxitsoftware.com/pdf/reader/download.php
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
:End
IF "%OS%"=="Windows_NT" ENDLOCAL
page last modified: 2024-04-16; loaded in 0.0052 seconds