command line printer problem using echo lpt2 commands

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Roe5685
Posts: 9
Joined: 17 May 2012 20:37

command line printer problem using echo lpt2 commands

#1 Post by Roe5685 » 30 Oct 2014 08:27

For years I printed from batch files using the following:
to set up: Net Use LPT2: "\\asrock-pc\lexmark e260d" & if you like /persistent:yes
then applying you put in the batch file echo what a nice day > LPT2 & the printer prints it.

well the above monochrome laser printer died and I cannot get the command to work on another printer. I tried two color laser printers one a Lexmark and No! I then tried another
monochrome brother printer and it not work but a least the print command worked.
in all of the above you get no exceptions it just NOT print!

for example on the monochrome brother : net use LPT2: \\asrock-pc\brother /persistent:yes
and then echo what a nice day > LPT2 does not work BUT the following works
print /d:\\Asrock-pc\brother hello.txt gives you a dos line saying hello.txt is currently being printed AND IT PRINTS! ( with the two color printers you get the currently being printed line but nothing prints. ) What also works is print /d:LPT2 hello.txt

So what is the solution please!!

As we heavily use this command sequence I have ordered a used e260d. But if you guys come up with a solution i can use ALL my printers!

Roe5685

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: command line printer problem using echo lpt2 commands

#2 Post by Squashman » 30 Oct 2014 08:40

I believe this has to do with most newer printers being GDI (Host Based) Printers.

Samir
Posts: 384
Joined: 16 Jul 2013 12:00
Location: HSV
Contact:

Re: command line printer problem using echo lpt2 commands

#3 Post by Samir » 15 Nov 2014 12:02

Two things may be a work here.

One is that you need to make sure lpt2 is 'captured' by the printer driver. It's like a drive mapping. If it's not, the echo is going nowhere.

Second is that a lot of newer printers need an end of file or end of page or line feed sent to them for them to print. I'd run across this on our Panasonic kxp-4450i when doing dos echos even back in the win 3.1 days.

I'd love to hear if you get it working. I still use some old dos programs and have to make sure printers can work old-school like your situation.

penpen
Expert
Posts: 1988
Joined: 23 Jun 2013 06:15
Location: Germany

Re: command line printer problem using echo lpt2 commands

#4 Post by penpen » 15 Nov 2014 17:02

If it is as Squashman assumes (printer does not support PCL6, only GDI), then maybe applications like DOSPRN (Shareware) may help you (i've never tested this application, only heard of it):
http://dosprn.com/

penpen

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: command line printer problem using echo lpt2 commands

#5 Post by foxidrive » 16 Nov 2014 01:21

Roe5685 wrote:What also works is print /d:LPT2 hello.txt


The previous posts have a lot of info, but to me your task is not clear,
as you've said that you want to use echo what a nice day and print to the printer
and you've said that print /d:LPT2 hello.txt works.

So using those things then it follows that you can do this:

Code: Select all

@echo off
>"%temp%\print.tmp" echo what a nice day
print /d:LPT2 "%temp%\print.tmp"
del "%temp%\print.tmp"


And with this batch file you use the following: call EchoPrint.bat Printing Ink is as expensive as Caviar!

EchoPrint.bat

Code: Select all

@echo off
>"%temp%\print.tmp" echo %*
print /d:LPT2 "%temp%\print.tmp"
del "%temp%\print.tmp"

Post Reply