Including .prn file with lpr command in Windows batch file
I need to do a downloadable Windows batch file (.bat) which runs lpr command on clients machine. That's easy. The hard part is that the batch file must include the data to be printed also. Everythin开发者_如何学Pythong needs to be in one downloadable-file that could be ran by the enduser.
Is there any way to include .prn file (Print-to-file -file) in batch file? Or can I somehow include the printer data on lpr command?
Thanks!
As far as know you cannot include print data in your lpr command. You can specify the file to print and that is it. But do you know the printer name of all the clients? It sounds like there might be a better way of deploying if the clients are on the same network.
You cannot include a .prn file in a .bat (or .cmd) file in any reasonable way (even if the .prn file is a text file). Again if clients are on the same network the .bat file (or .cmd) could access the .prn file stored in a shared place.
Lpr: Sends a file to a computer running Line Printer Daemon in preparation for printing.
Syntax
lpr [-S ServerID] -P PrinterName [-C BannerContent] [-J JobName] [{-o | -o l}] [-d] [-x] FileName
"The hard part is that the batch file must include the data to be printed also. Everything needs to be in one downloadable-file that could be ran by the enduser."
I'm a little unclear on this, however to me it sounds like you want the batch script to include the text of the data you wish to print?
It looks as if you can have the information in say a .txt file and pass it through lpr:
lpr -P printername -x file.txt
If you need information from a .prn file inside of this printed .txt file, you can try:
TYPE file.prn>>file.txt
However not sure if TYPE will work on a .prn file.
精彩评论