Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Are you talking about making an old DOS application print to a network printer? I posted some messages about that recently.
The problem happens with old DOS programs that can ONLY print to LPT1 or some other local printer port. We have a very important program here at our office that is like that. Nobody seemed to know how to make this happen, so I had to dig up the answer myself. The information below is what worked for us.
The secret is all in a little command line utility called DEVCON.exe. You can download it from Microsoft. Win XP will not let you use the "Net Use" command to reroute an LPT port. You have to break the current mapping using the DEVCON utility. Then the NET USE command works. Here is the article that references DEVCON:
Microsoft Article (Q311272): DevCon Command Line Utility Alternative to Device Manager.
******************************************************************
Domain Instructions
******************************************************************Here are the steps to follow if you have a domain controller and local users do not have Administrator rights to their local machines (this is our situation):
1. Create an Icon on the desktop for the user that opens a command prompt to the directory you wish them to be in, or that starts the program you want them to open. Here is what you put in the Target field for the shortcut:
%SystemRoot%\system32\cmd.exe /k menu.bat
Substitute "menu.bat" for the name of your own DOS program start file. Menu.bat is the batch file that starts our software.
2. Copy the devcon.exe file to the user's local c:\ directory. This program can deactivate hardware settings from the command line in XP. It is from Microsoft.
3. If you have more than 1 network printer, change the User's Profile on the Domain Controller depending on where they want their print jobs to go. On our network, I have 2 login scripts for the 2 possible printers that this program will send jobs to. They are called "CUS-adm-login.bat" for our Admin HP 8150 and "CUS-acc-login.bat" for the Acct HP 8150. People who do not use this program have a different login script.
These login scripts adds the following lines to our regular user login:
REM this line disables current port mapping to lpt1
REM this must be executed at system start up in a login script
REM if the user does not have local administrative rights
devcon disable *PNP0401REM this line reroutes the lpt1 port to the specified network share
REM make sure that the shared printer name has 8 characters or less
REM otherwise DOS can get confused and not connect properly
REM delete the REM on the line you want to use to activate the correct printer
REM Next line sends the job to the Accounting Dept Printer
REM net use lpt1 \\foxdc1\acc8150
REM Next line sends the job to the Administrative Dept Printer
REM net use lpt1 \\foxdc1\adm8150
4. Note: devcon will disable the port mapping to LPT1.
This may prevent other programs from printing correctly to
a local printer on lpt1 after this command is executed.
You will probably have to reboot in order to restore this.******************************************************************
Peer-to-Peer Instructions
******************************************************************If you are running a smaller peer-to-peer workgroup at home, it is easier to just give all the users Administrative rights to their computers. In that case, the steps are much easier. You do not have to fool around with server login scripts.
1. Create an Icon on the desktop for the user that opens a command prompt to the directory you wish them to be in. Here is what you put in the Target field for the shortcut:
%SystemRoot%\system32\cmd.exe /k printdos.bat
2. Copy the devcon.exe file to the user's local c:\ directory. This program can deactivate hardware settings from the command line in XP. It is from Microsoft.
3. Use a text editor to create a batch file called printdos.bat (referenced above in the icon instructions) with the following lines:
REM this line disables current port mapping to lpt1
REM the user MUST have local administrative rights
devcon disable *PNP0401REM this line reroutes the lpt1 port to the specified network share
REM make sure that the shared printer name has 8 characters or less
REM otherwise DOS can get confused and not connect properly
net use lpt1 \\computername\printernameREM this line will start your DOS program for the user
start.exe4. Note: Substitute "Start.exe" with the real name for your DOS application. This will be a .bat, .exe or .com file.
5. Note: In the above batch file substitute your computer and shared printer names. For example on my network the line reads \\foxdc1\adm8150. "foxdc1" is our domain controller and "adm8150" is the name I gave to the share from that computer for 1 of our HP8150 printers.
6. Note: devcon will disable the port mapping to LPT1.
This may prevent other programs from printing correctly to
a local printer on lpt1 after this command is executed.
You will probably have to reboot in order to restore this.That's it. Let me know if you have other problems.
-Brian

What do you mean WinXP won't let you redirect an LPT port to a Network printer? I just did it and printed a text document from the command line. W2000 and XP aren't that different, and we do it all the time in 2000.
Are you sure you got the syntax right when you were trying to set it up?Net use LPT1: \\server\printer

Long printer names can easily be handled in Dos sessions as well as printer names with spaces by using quotes... i.e.;
NET USE LPT1 "\\\Daisys Left Hand Printer"
Hope this helps,
Beverly Howard

Long printer names can easily be handled in Dos sessions as well as printer names with spaces by using quotes... i.e.;
NET USE LPT1 "\\computername\Daisys Left Hand Printer"
Hope this helps,
Beverly Howard

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |