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"

Thanks
ISUYAsked:
Who is Participating?
 
aavictorCommented:
IF you like to cmd DOS command such as PRINT

SYNTAX
==========
print /d:\\printserver\sharenamedrive:\path\filename
example,
print /d:\\printserver\P1131  c:\tmp.txt
Note:
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.

REFERENCE

http://support.microsoft.com/kb/314499
0
 
acerimmer10Commented:
Have a look at the PrintAny.bat section at the bottom of the page on this website..

http://www.robvanderwoude.com/printfiles.php
0
 
Bill PrewCommented:
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"

~bp
0
 
ISUYAuthor Commented:
ok, I did this:

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

Thks you all
0
 
ISUYAuthor Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.