REM Uses Phil Harvey's ExifTool: https://exiftool.org/exiftool.exe -PageCount filename.pdf
REM Uses PDFtk - The PDF toolkit: https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/PDFtk.exe filename.pdf dump_data | FIND.EXE "NumberOfPages"REM Uses GhostScript: https://www.ghostscript.com/gswin32c.exe -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=outputfile.pdf -dBATCH inputfile1.pdf inputfile2.pdf inputfile3.pdf [ ... ]
REM Uses PDFtk - The PDF toolkit: https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/PDFtk.exe inputfile1.pdf inputfile2.pdf inputfile3.pdf [ ... ] output outputfile.pdf
REM Uses GhostScript: https://www.ghostscript.com/REM Use doublequotes for PageList if it contains commas.REM If no PageList is specified for a file, the last known PageList will be used,REM hence 1- (page 1 and onwards) for the second file in this example.gswin32c.exe -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=outputfile.pdf -dBATCH -sPageList="2-5,7" inputfile1.pdf -sPageList=1- inputfile2.pdf -sPageList=12- inputfile3.pdf [ ... ]
REM Uses PDFtk - The PDF toolkit: https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/REM Only ranges, no individual pages.REM If no range is specified for a file, the entire PDF is merged.PDFtk.exe A=inputfile1.pdf B=inputfile2.pdf C=inputfile3.pdf cat A2-7 C12-end output outputfile.pdf
REM Uses PDFtk - The PDF toolkit: https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/REM Workaround for the "only ranges" limitation: use multiple qualifiersREM for the same file (e.g. A and B are both referencing inputfile1.pdf).PDFtk.exe A=inputfile1.pdf B=inputfile1.pdf C=inputfile2.pdf D=inputfile3.pdf cat A2-5 B7 D12-end output outputfile.pdf
REM Uses Acrobat Reader: https://get.adobe.com/reader/REM Will probably fail with Acrobat "Writer" installed.REM Open a Print dialog to print pdffile to the default printer.Acrobat.exe /P pdffile
REM Uses Acrobat Reader: https://get.adobe.com/reader/REM Will probably fail with Acrobat "Writer" installed.REM Silently print pdffile to any printer (printerdriver and printerport optional).Acrobat.exe /N /T pdffile printer [ printerdriver [ printerport ] ]
REM Uses Foxit PDF Reader: https://www.foxit.com/pdf-reader/REM Silently print pdffile to the default printer.FoxitPDFReader.exe /p pdffile
REM Uses Foxit PDF Reader: https://www.foxit.com/pdf-reader/REM Silently print pdffile to any printer.FoxitPDFReader.exe /t pdffile printer
REM Uses GhostScript: https://www.ghostscript.com/REM Silently print pdffile to any printer.gswin32c.exe -dPrinted -dBATCH -dNOPAUSE -dNOSAFER -q -dNumCopies=1 -sDEVICE=mswinpr2 -sOutputFile="%printer%PrinterName" pdffile
REM Uses OpenOffice Draw: https://www.openoffice.org/download/REM or LibreOffice Draw: https://www.libreoffice.org/download/download-libreoffice/REM Silently print pdffile to the default printer.sdraw.exe -p pdffile
REM Uses OpenOffice Draw: https://www.openoffice.org/download/REM or LibreOffice Draw: https://www.libreoffice.org/download/download-libreoffice/REM Silently print pdffile to any printer.sdraw.exe -pt printer pdffile
REM Uses whatever program is registered for handling PDF filesREM Not all programs have a registered Print verb, and even less programs have a registered PrintTo verb.REM Fails if no Print or PrintTo verb is registered for .pdf files (e.g. if Acrobat Writer is installed).@ECHO OFF
REM Save this code as PrintPDF.bat, then useREM PrintPDF pdffileREM to print to the default printer, orREM PrintPDF pdffile printerREM to print to any printer.SET PrintVerb=print
IF NOT "%~2"=="" SET PrintVerb=printto
FOR /F "tokens=2 delims==" %%A IN ('ASSOC .pdf') DO (
FOR /F "tokens=2*" %%B IN ('REG.EXE Query HKCR\%%A\shell\%PrintVerb%\command') DO (
CALL %%C
))gs, on 32-bit Windows it is gswin32c, and on 64-bit Windows it is gswin64c.
WMIC.EXE Path Win32_Printer Get DeviceID | MORE.COM /E +1 to list all available printer names
page last modified: 2024年09月01日; loaded in 0.0056 seconds