I have a folder with hundreds of small PDF files to print.
How can I make a batch job to print them out in alphabetical order?

link|improve this question
feedback

3 Answers

Details here about silent print command in Adobe reader:

http://support.adobe.com/devsup/devsup.nsf/docs/52080.htm

so you can do (batch file):

for %%X in (*.pdf) do AcroRd32.exe /t %%X "\\servername\printername"

or (cmd prompt):

for %X in (*.pdf) do AcroRd32.exe /t %X "\\servername\printername"
link|improve this answer
Hi this does not guarantee the print in alphabetical order. :( – E_M Mar 5 '10 at 11:44
Well, it does the same as a standard DOS dir *.pdf so it should be in order... – Shevek Mar 5 '10 at 12:02
try this to prove the sort order: for %X in (*.pdf) do echo %X – Shevek Mar 5 '10 at 12:06
don't work... just try. I create files: 3.pdf, 1.pdf, 2.pdf in a folder. then your command: C:\1>for %X in (*.pdf) do "C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Acrobat.ex e" /t %X C:\1>"C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe" /t 1.pdf C:\1>"C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe" /t 2.pdf C:\1>"C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe" /t 3.pdf but in the printer I found this order of printing: 2-1-3. LOL! :) – E_M Mar 5 '10 at 12:08
that doesn't make sense!!! if the command is executed 1,2,3 then it should print 1,2,3... – Shevek Mar 5 '10 at 16:37
show 3 more comments
feedback
dir /b | sort > %temp%\files.tmp
for /f %f in (%temp%\files.tmp) do AcroRd32.exe /t %f "\\servername\printername"
del %temp%\files.tmp
link|improve this answer
feedback

I know this isn't stackoverflow, but the only way I could do this would be in python.

Recepie for printing pdf file:

from win32com import client
import time

ie = client.Dispatch("InternetExplorer.Application")

def printPDFDocument(filename):

    ie.Navigate(filename)

    if ie.Busy:
        time.sleep(1)

    ie.Document.printAll()
    time.sleep(2)

ie.Quit()

Recepie for list all files from a dir:

   import os
   path="C:\\somedirectory"  # insert the path to the directory of interest here
   dirList=os.listdir(path)

Recepie for sorting alfabetically the list of files:

a.sort()  # a is the list

Well just by joining the 3 recepies, you can have your problem solved.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown