Print each file in a directory

Hello, I need to create a BAT file to print all files in a specific directory, I do´t need to print the list of files in the directory, I need to print each file.
Also the name of the files change each day.
All files are text files, but not with the extension ".txt"

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Have a look at the PrintAny.bat section at the bottom of the page on this website..
IF you like to cmd DOS command such as PRINT

print /d:\\printserver\sharenamedrive:\path\filename
print /d:\\printserver\P1131  c:\tmp.txt
This is a dot-matrix printer that should accept text file printing; Otherwise,
there is no promise.

Base on this command,
you can use FOR looping to get filenames of commad DIR in the folder you want. After that,
print each file.

FOR /F %i in ('dir /d c:\output') DO PRINT /d:\\printserver\P1131  "c:\output\%i"

where I assume the filenames have no space character(s).  If not,
you should change FOR paramter delims=;   or another character.  So,
you can get full filename and externsion.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bill PrewIT / Software Engineering ConsultantCommented:
Not for points, aavictor has you pointed in the right direction, just a couple of notes to that.  I would use a slightly simpler version of the FOR statement like this:

for %A in ("c:\temp\*.*") do print /D:printer-name "%A"

This should print all files in the c:\temp folder to the printer named "printer-name" on your system.

Also, if you want to do this in a BAT file then the syntax changes slightly, to:

for %%A in ("c:\temp\*.*") do print /D:printer-name "%%A"

ISUYAuthor Commented:
ok, I did this:

for %%A in ("c:\temp\1\*.*") do start /w notepad /p "%%A"

Thks you all
ISUYAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.