Link to home
Start Free TrialLog in
Avatar of Fig68
Fig68

asked on

Print from DOS to Network Printer

Is there a way to write a bat file to print to a network printer?
Avatar of mikesuss
mikesuss

Use the net.exe command to establish a persistent connection. To do this, use the following syntax at a command prompt
net use lptx \\printserver\sharename /persistent:yes
where x is the number of the printer port that you want to map, where printserver is the print server that is sharing the printer, and where sharename is the name of the printer share.

For example, to map LPT2 to a printer shared as Laser1 on a print server that is named Pserver, follow these steps:
Click Start, and then click Run.
In the Open box, type cmd, and then click OK.
Type net use lpt2 \\pserver\laser1 /persistent:yes, and then press ENTER.
To quit the command prompt, type exit, and then press ENTER.
Note In Windows XP, non-administrative users cannot map an LPT port to a network printer path when the LPT port exists on the computer as a physical parallel port.

For more information about how to map LPT ports as a regular user, click the following article number to view the article in the Microsoft Knowledge Base:
313644  Non-administrators cannot remap an LPT port to a network printer
SOLUTION
Avatar of mikesuss
mikesuss

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Fig68

ASKER

OK Cool I got it to test print to a shared printer with mikesuss method 2, one more question this printer isn't shared but does have an ip address is there any way of doing this with an ip address instead of a share name?

Thanks
I have used the methods in both of the comments above and while they work I feel a slicker solution is to use printer pooling.

Essentially all you do is open the properties page for the network printer you want to print to and go to the Ports tab. Click the "Enable printer pooling" check box and then check the box next to the LPT or COM port your DOS program prints to. After pressing the "Apply: button print jobs going to the LPT or COM port you specified will be handled by the network printer.

I have used this on quite a few networks, printers and applications. It seems to be reliable, more so than a batch file. It even works for printing in a Server 2003 remote session to a local printer.
instead of \\share\printername use \\ip_address\name
Having used both methods for quite some time the printer pooling solution is easier, cleaner and less trouble. Unless you like writing batch files or the computer your trying to print from predates XP why bother?

An additional bonus is that if the printer is a stand alone network printer (not connected to a computer) the pooling solution can print directly to the printer eliminating network traffic and possible problems with the server computer.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Having come back to answering questions here on EE I'm now beginning to remember one of the reasons I stopped. Not to pick on anyone in particular but it seems that many don't read the entire message thread or if they do they have no problem in repeating previously given solutions. It is a bit frustrating to come back to a conversation and find the same ground being plowed again.
Avatar of Fig68

ASKER

Thanks for the help