How to print to a network printer from an MS-DOS-based program in Windows XP
By default, most MS-DOS-based programs print directly to either the LPT1 port or to the LPT2 port. However, the output is not automatically routed across a redirector to a print share unless you use one of the following methods.
Method 1
Use the net.exe command to establish a persistent connection. To do this, use the following syntax at a command promptnet 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.
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
Method 2
Print directly to the printer share by using the following syntax at a command promptprint /d:\\printserver\sharenamedrive:\path\filename
where printserver is the print server sharing the printer, where sharename is the name of the printer share, and where drive:, path, and filename make up the complete path of the document that you want to print.For example, to print a document that is named letter.doc from the root directory of drive C 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 print /d:\\pserver\laser1 c:\letter.doc, and then press ENTER.
The following command-line message appears: - To quit the command prompt, type exit, and then press ENTER.
net use lptx \\server\queue
If the LPT port is redirected successfully, you receive the following message:To disconnect persistent LPTx connections, use the following syntax:
net use lptx /delete
No comments:
Post a Comment