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

19.6k views Asked by At

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...

3

There are 3 answers

1
Joao Jesus On

If you have Windows 7 you can right click on the files and select to Print.

As far as I know you can select all files of a specific type (Word, PDF, etc) and print them this way. It does not allow you to print all of the files selected if they have different types, so you must choose each type at a time. (eg. search for .PDF on the folder, select all files, right click them and choose the Print option)

0
MC ND On

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"
)
0
Ashwith Ullal On
dir *.txt /b /s >> C:\temp\test.txt

try this