Batch print files in alphabetical order

6,890

Solution 1

dir /b | sort > %temp%\files.tmp
for /f %f in (%temp%\files.tmp) do AcroRd32.exe /t %f "\\servername\printername"
del %temp%\files.tmp

Solution 2

Details here about silent print command in Adobe reader.

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"
Share:
6,890

Related videos on Youtube

Christoph Rüegg
Author by

Christoph Rüegg

Updated on September 17, 2022

Comments

  • Christoph Rüegg
    Christoph Rüegg almost 2 years

    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?

  • user1184899
    user1184899 over 14 years
    Hi this does not guarantee the print in alphabetical order. :(
  • Shevek
    Shevek over 14 years
    Well, it does the same as a standard DOS dir *.pdf so it should be in order...
  • Shevek
    Shevek over 14 years
    try this to prove the sort order: for %X in (*.pdf) do echo %X
  • user1184899
    user1184899 over 14 years
    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! :)
  • Shevek
    Shevek over 14 years
    that doesn't make sense!!! if the command is executed 1,2,3 then it should print 1,2,3...
  • Shevek
    Shevek over 14 years
    I repeated same with the echo test, creating 2,1,3 and it has definitely echoed 1,2,3... (I'm on Win7)
  • user1184899
    user1184899 over 14 years
    Hi! I know that is weird :(
  • Shevek
    Shevek over 14 years
    what happens if you pause the print queue and send to print. What order do they appear in the queue?
  • Jess Stone
    Jess Stone over 10 years
    thanks for your solution. anyway how come windows explorer sorts files in a different order?