LPT1: DOS program problem

P

Paul H

I use a DOS program that I wrote years ago by using this 2 line .BAT file
on my XP Pro laptop. When my program writes to LPT1: I get a small window
that asks me to enter a file name to write to.
NET USE LPT1: \\Pc296673087013\Textfile
C:\util\LOAN.COM
Changing the computer name to my Vista Home Premium's name, then using it on
my new Vista laptop, causes an error 66, followed by "The network resource
type is not correct." But the program does run correctly in a DOS window -
it just won't print. How can I make the printer work? TIA, Paul
 
D

Dave R.

Paul H said:
I use a DOS program that I wrote years ago by using this 2 line .BAT
file
on my XP Pro laptop. When my program writes to LPT1: I get a small
window
that asks me to enter a file name to write to.
NET USE LPT1: \\Pc296673087013\Textfile
C:\util\LOAN.COM
Changing the computer name to my Vista Home Premium's name, then using
it on
my new Vista laptop, causes an error 66, followed by "The network
resource
type is not correct." But the program does run correctly in a DOS
window -
it just won't print. How can I make the printer work? TIA, Paul

I've used a similar approach under Windows 2000 and XP, so I gave it a
try to see if I could make it work in Vista. Ultimately, I couldn't get
it to work properly :(.

Here's what I did:
Added a new local printer configured for the "port" called File: (Print
to File), using the Generic / Text Only driver.
Tested by printing from Notepad, it prompted for a file name and worked
fine.
Set the printer to Shared and gave Everyone full permissions. (As an
aside, Vista wouldn't let me turn on printer sharing in the network and
sharing center because it claimed I didn't have a printer attached. I
had to physically attach and configure a real printer before I could
enable printer sharing...)
Started a command prompt and tried the NET USE LPT1:
\\mycomputername\myprintername and got told that the password was
invalid for \\mycomputername\myprintername and was prompted for a
username and password for mycomputername.
Supplying a standard account user name and password failed with a system
error 5 has occurred, access is denied.
Supplying an administrator account username and password failed with the
same error.
Tried again from an elevated command prompt, and the net use command
completed successfully.
Tested by trying "echo blah>LPT1:" from both a standard and an elevated
command prompt but never got a dialog asking for the file name like I do
under XP.
Checked the print queue, and showed two documents called "Local
Downlevel Document". The first had a status of "Error - Printing" and a
port of FILE:
Deleted the print jobs from the queue, and ran "NET USE LPT1: /DELETE"
to remove the port redirection.
Ran "NET USE LPT1: \\mycomputername\myotherprintername" from an elevated
command prompt to see if the problem was with redirecting LPT1 or with
the FILE printer type.
Ran "echo blah>LPT1:" again, and it worked.

It looks like the problem is with redirecting another device to the FILE
device. I've no idea what else to try, but as far as I can tell it's
just broken in Vista.

Does anyone else have any ideas?

Regards,

Dave
 
P

Paul H

Dave, first let me thank you for the non-trivial effort you expended. I
tried "NET USE LPT1: \\Paulsacerlaptop\Brother HL-5140" and got error 1326 -
"Logon failure: unknown user name or bad password". I don't know what an
elevated command prompt is, or how to invoke it as part of my batch file.
In this case, printing directly to the printer, not to a text file, is
acceptable, although I have other instances where the ability to print to a
file is crucial. Thx, Paul
===========================

"Dave R." <dwragle at drbsystems dot com> wrote in message

Paul H said:
I use a DOS program that I wrote years ago by using this 2 line .BAT
file
on my XP Pro laptop. When my program writes to LPT1: I get a small
window
that asks me to enter a file name to write to.
NET USE LPT1: \\Pc296673087013\Textfile
C:\util\LOAN.COM
Changing the computer name to my Vista Home Premium's name, then using
it on
my new Vista laptop, causes an error 66, followed by "The network
resource
type is not correct." But the program does run correctly in a DOS
window -
it just won't print. How can I make the printer work? TIA, Paul

I've used a similar approach under Windows 2000 and XP, so I gave it a
try to see if I could make it work in Vista. Ultimately, I couldn't get
it to work properly :(.

Here's what I did:
Added a new local printer configured for the "port" called File: (Print
to File), using the Generic / Text Only driver.
Tested by printing from Notepad, it prompted for a file name and worked
fine.
Set the printer to Shared and gave Everyone full permissions. (As an
aside, Vista wouldn't let me turn on printer sharing in the network and
sharing center because it claimed I didn't have a printer attached. I
had to physically attach and configure a real printer before I could
enable printer sharing...)
Started a command prompt and tried the NET USE LPT1:
\\mycomputername\myprintername and got told that the password was
invalid for \\mycomputername\myprintername and was prompted for a
username and password for mycomputername.
Supplying a standard account user name and password failed with a system
error 5 has occurred, access is denied.
Supplying an administrator account username and password failed with the
same error.
Tried again from an elevated command prompt, and the net use command
completed successfully.
Tested by trying "echo blah>LPT1:" from both a standard and an elevated
command prompt but never got a dialog asking for the file name like I do
under XP.
Checked the print queue, and showed two documents called "Local
Downlevel Document". The first had a status of "Error - Printing" and a
port of FILE:
Deleted the print jobs from the queue, and ran "NET USE LPT1: /DELETE"
to remove the port redirection.
Ran "NET USE LPT1: \\mycomputername\myotherprintername" from an elevated
command prompt to see if the problem was with redirecting LPT1 or with
the FILE printer type.
Ran "echo blah>LPT1:" again, and it worked.

It looks like the problem is with redirecting another device to the FILE
device. I've no idea what else to try, but as far as I can tell it's
just broken in Vista.

Does anyone else have any ideas?

Regards,

Dave
 
D

Dave R.

Paul H said:
Dave, first let me thank you for the non-trivial effort you expended.
I
tried "NET USE LPT1: \\Paulsacerlaptop\Brother HL-5140" and got error
1326 -
"Logon failure: unknown user name or bad password". I don't know what
an
elevated command prompt is, or how to invoke it as part of my batch
file.
In this case, printing directly to the printer, not to a text file, is
acceptable, although I have other instances where the ability to print
to a
file is crucial. Thx, Paul
===========================

No problem, Paul. I figured I'd eventually have to see if I could get
it to work so there was no time like the present :)

Anyway, the elevated command prompt just means I ran cmd.exe as an
administrator, so that's not something you can do inside of a batch file
as far as I know. Until someone has any other ideas, the only thing
I've seen that might help was from a post over in the networking_sharing
group from Davide Guolo:
you may want to have a look at Printfil to capture the DOS LPT1:
output and
forward it to any printer installed on your Vista machine (including
GDI and
virtual printers)

You can find more info and a free trial version to download at
http://www.printfil.com

I've not tried it, so I don't know if it will do what you need but it
may be worth a try.

Regards,

Dave
 
R

RScotti

Anyway, the elevated command prompt just means I ran cmd.exe as an
administrator, so that's not something you can do inside of a batch file
as far as I know. Until someone has any other ideas, the only thing
I've seen that might help was from a post over in the networking_sharing
group from Davide Guolo:

I hope this helps you Here's what I did.
Just type CMD in the search box than pin the command prompt to the start menu, than right click on it and run as
administrator.
I have a bat file and it works for me!

Have a good day,
RScotti

remove "nospam" in order to email me.
 
D

Dave R.

RScotti said:
I hope this helps you Here's what I did.
Just type CMD in the search box than pin the command prompt to the
start menu, than right click on it and run as
administrator.

That's how I run the elevated command prompt as well.
I have a bat file and it works for me!

So, if you run the bat file from an elevated command prompt, it works?
When I ran the commands individually from an elevated command prompt it
didn't work, but I didn't try it in a bat. What's your bat file look
like?

Best regards,

Dave
 
R

RScotti

Hi Dave,
That's how I run the elevated command prompt as well.


So, if you run the bat file from an elevated command prompt, it works? Yes it does work fine.
When I ran the commands individually from an elevated command prompt it
didn't work, but I didn't try it in a bat. What's your bat file look
like? Here it is:
@echo off
xcopy /s /y /d /h /c "C:\users\rls\Agent" "G:\Agent\"
xcopy /s /y /d /h /c "C:\users\rls\Agent" "D:\Agent\"
xcopy /s /y /d /h /c "C:\users\rls\Agent XP" "F:\Agent XP\"
xcopy /s /y /d /h /c "C:\users\rls\Agent XP" "D:\Agent XP\"
xcopy /s /y /d /h /c "C:\users\rls\Agent" "M:\Agent\"
xcopy /s /y /d /h /c "C:\Users\rls\Documents" "G:\Documents\"
xcopy /s /y /d /h /c "C:\Users\rls\Documents" "D:\Documents\"
xcopy /s /y /d /h /c "C:\Users\rls\Downloads" "G:\Downloads\"
xcopy /s /y /d /h /c "C:\Users\rls\Downloads" "D:\Downloads\"
xcopy /s /y /d /h /c "C:\USERS\RLS\Pictures" "G:\Pictures\"
xcopy /s /y /d /h /c "C:\USERS\RLS\Pictures" "D:\Pictures\"
xcopy /s /y /d /h /c "C:\Users\rls\Favorites" "G:\Favorites\"
xcopy /s /y /d /h /c "C:\Users\rls\Favorites" "D:\Favorites\"
xcopy /s /y /d /h /c "C:\Users\rls\Backup" "G:\Backup\"
xcopy /s /y /d /h /c "C:\Users\rls\Backup" "D:\Backup\"
xcopy /s /y /d /h /c "C:\Users\rls\Backup" "G:\ABackup\"
xcopy /s /y /d /h /c "C:\Users\rls\Setup" "G:\Setup\"
xcopy /s /y /d /h /c "C:\Users\rls\Setup" "D:\Setup\"
xcopy /s /y /d /h /c "C:\Users\rls\Setup" "G:\ABackup\"



Best regards,

Dave

Have a good day,
RScotti

remove "nospam" in order to email me.
 
D

Dave R.

RScotti said:

Oh, well, that's completely different. We were talking about
redirecting the LPT1: port to a printer configured to print to the FILE:
device and being able to print to it from a DOS program / CMD prompt and
have it ask for the file name. Thanks anyway, though.

Regards,

Dave
 
R

RScotti

Anyway, the elevated command prompt just means I ran cmd.exe as anThis is all I was trying to answer for you. Just show you how to run the elevated CMD with a batch file.

Oh, well, that's completely different. We were talking about
redirecting the LPT1: port to a printer configured to print to the FILE:
device and being able to print to it from a DOS program / CMD prompt and
have it ask for the file name. Thanks anyway, though.

Regards,

Dave

Have a good day,
RScotti

remove "nospam" in order to email me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top