I want to create a batch script that will print all the files I have in a folder, in order of date modified

15,303

You should take a look at PrintAny.bat, which should handle the task of printing one file from batch.

For the task of doing it in modification date order, dir command will supply the list in the desired order. Then for command will handle this list, calling PrintAny to do the printing part.

for /f "tokens=*" %%f in ('dir /od /tw /b /a-d "c:\DocDir\*.*"') do (
    call printAny.bat "%%~ff"
)
Share:
15,303
TonyT
Author by

TonyT

Updated on June 04, 2022

Comments

  • TonyT
    TonyT almost 2 years

    I've got no idea where to start with this :-/

    I have a folder with around 500 files in it, that I would like to print off in order of date modified. I could go through and do them one by one, but why do that when I'm sure there will be a way using batch!

    Please help...

  • Uke
    Uke over 6 years
    this has the downside that you can choose a maximum of 15 files (default value that is changeable in regedit) and you don't get the print in order, as was wished.