Problems printing with DOS program using "net use lpt1"

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
needbatchhelp
Posts: 3
Joined: 21 Jan 2015 22:12

Problems printing with DOS program using "net use lpt1"

#1 Post by needbatchhelp » 21 Jan 2015 22:26

I have a program called Books that runs in DOS on my windows XP system. It prints from my network printer instead of my USB printer. I tried the "Net use lpt1...." thing and it tells me "local device name already in use" and error 85and still prints to the network printer


So the bat file is where I put the net use lpt1. I actually changed "Gina" which is the computer name to the name the computer uses on the network, forgot to take a new pic. And "printer" is the shared name for the printer. Any idea on how to fix this?
Also, what does all the other stuff mean below the "net use" line?


https://imgur.com/a/IScom

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

Re: Problems printing with DOS program using "net use lpt1"

#2 Post by foxidrive » 22 Jan 2015 02:14

needbatchhelp wrote:I have a program called Books that runs in DOS on my windows XP system. It prints from my network printer instead of my USB printer. I tried the "Net use lpt1...." thing and it tells me "local device name already in use" and error 85and still prints to the network printer


"local device name already in use" indicates that there is already a LPT1 it looks like.

So the bat file is where I put the net use lpt1. I actually changed "Gina" which is the computer name to the name the computer uses on the network, forgot to take a new pic. And "printer" is the shared name for the printer. Any idea on how to fix this?
Also, what does all the other stuff mean below the "net use" line?
https://imgur.com/a/IScom


Stuff below which net use line? You're showing two.

Be specific in your question please.

needbatchhelp
Posts: 3
Joined: 21 Jan 2015 22:12

Re: Problems printing with DOS program using "net use lpt1"

#3 Post by needbatchhelp » 22 Jan 2015 02:42

How would I go about fixing the problem? Would changing it to LPT2 or LPT3 in the bat file fix the issue?

I forgot to mention that I am the admin user if that makes a difference.

ShadowThief
Expert
Posts: 1163
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Problems printing with DOS program using "net use lpt1"

#4 Post by ShadowThief » 22 Jan 2015 03:18

Try deleting the port with

Code: Select all

net use LPT1: /Delete
before running the script.

ShadowThief
Expert
Posts: 1163
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Problems printing with DOS program using "net use lpt1"

#5 Post by ShadowThief » 22 Jan 2015 03:28

And as for what everything else does...

Code: Select all

:: Prevent the commands from being displayed on the command prompt as they are being run
@echo off

:: Go to the D:\BOOKS directory. This could also have been achieved with the command cd /d D:\BOOKS
D:
CD \BOOKS

:: Run FOXR.exe with the options BL and -T. I have no idea what this does. Google is telling me that foxr.exe is FoxPro, but that isn't how you use the B or L flags.
FOXR BL -T

:: Goes to D:\
CD \

:: Outputs either a ÿ or a space, depending on your code page. Honestly, there's probably no reason for this line.
ECHO ÿ

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

Re: Problems printing with DOS program using "net use lpt1"

#6 Post by Squashman » 22 Jan 2015 06:02

I am wondering why you took a picture of the screen when doing a screenshot or just copying and pasti g from the programs would have been a lot easier for everyone.

needbatchhelp
Posts: 3
Joined: 21 Jan 2015 22:12

Re: Problems printing with DOS program using "net use lpt1"

#7 Post by needbatchhelp » 22 Jan 2015 12:06

Do I just open cmd window and put in the delete code? Or should I put it as the first line of the bat file?

If I do it with a cmd window, do I have to do this everytime I turn on the computer? Or is there a way to do it automatically?

ShadowThief wrote:Try deleting the port with

Code: Select all

net use LPT1: /Delete
before running the script.

ShadowThief
Expert
Posts: 1163
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Problems printing with DOS program using "net use lpt1"

#8 Post by ShadowThief » 22 Jan 2015 18:14

Well, first I would try out the command to see if it even works. Just put the code in a command prompt.

And then if it does fix the problem, I would reboot and see if the problem comes back.
  • If the problem is initially fixed but comes back after the reboot, you need to add the line to the top of the batch file.
  • If the problem is initially fixed and does not come back after the reboot, don't worry about it.

Davide Guolo
Posts: 1
Joined: 05 Feb 2015 09:14

Re: Problems printing with DOS program using "net use lpt1"

#9 Post by Davide Guolo » 05 Feb 2015 09:18

This Microsoft article may also help: http://support.microsoft.com/kb/253821/

Post Reply