How to print to both file and paper in MS-DOS?

For stuff that really doesn't have ANYTHING to do with Puppy
Post Reply
Message
Author
User avatar
Galbi
Posts: 1098
Joined: Wed 21 Sep 2011, 22:32
Location: Bs.As. - Argentina.

How to print to both file and paper in MS-DOS?

#1 Post by Galbi »

I've spent the hole day with this "caprice".

Thou it's very easy to do it in *nix, unfortunately I need it in Windows.

I'd like to have everything that is printed in a dot matrix printer (that hangs from a Win XP) to be printed in paper AND printed to a file. It's some kind of back-up of what it's printed.

The software is a good old DOS program which does not have the option to choose where to print, but it easy to redirect the printing to a file with SET PRINTER=
But I want both, file and paper.

Any ideas?

Thanks.
Remember: [b][i]"pecunia pecuniam parere non potest"[/i][/b]

Bruce B

#2 Post by Bruce B »

As I recall, the DOS Editor has the option to print to an LPT port or print to file.

Regarding the DOS Editor, the ones that come with Windows 95 and 98 are better editors than the earlier ones.

The pre Windows 95 DOS also has a utility called PRINT. I forgot about it. But the HELP utility should educate on the basics.

User avatar
Makoto
Posts: 1665
Joined: Fri 04 Sep 2009, 01:30
Location: Out wandering... maybe.

#3 Post by Makoto »

I couldn't be sure about a DOS version, but there's probably system-administrator software that'll let you automatically log a binary file copy of anything sent to the printer on the network. All you'd have to do would be to set it up for a single-system "network." :)
[ Puppy 4.3.1 JP, Frugal install ] * [ XenialPup 7.5, Frugal install ] * [XenialPup 64 7.5, Frugal install] * [ 4GB RAM | 512MB swap ]
In memory of our beloved American Eskimo puppy (1995-2010) and black Lab puppy (1997-2011).

Keisha
Posts: 469
Joined: Tue 18 Nov 2014, 05:43

re: Printing to file and paper (in MS-DOS)

#4 Post by Keisha »

It might help if we know the name of the DOS program, or at least the programming language of its source code.

Ibidem
Posts: 549
Joined: Wed 26 May 2010, 03:31
Location: State of Jefferson

#5 Post by Ibidem »

The thought that immediately crosses my mind is redirect printer to file, then print file.
However, I'm sure there are some reasons that won't work.
Off the top of my head, you'd probably need to empty and backup the file every print, and you'd have a rather complex/cludgy setup.

General form of what I'm thinking about (mind you, this is from a guy who hasn't really used DOS/Windows for 5-6 years):

Code: Select all

#assuming PRINTER=prnfile.txt
PRNFILE=prnfile.txt
print %PRNFILE%
type %PRNFILE% >>prnsave.txt
del %PRNFILE%

User avatar
Galbi
Posts: 1098
Joined: Wed 21 Sep 2011, 22:32
Location: Bs.As. - Argentina.

#6 Post by Galbi »

Thanks all for your answers.

With more googling, I've found this tool:
http://leelusoft.blogspot.com.ar/p/watc ... er-25.html
which seems of help, I´ve to think it a bit more.

The program in question it´s my billing software I use at my pharmacy. It´s written in COBOL. It´s closed software, I can ask the programer for new functionalities if they ´re really needed, but this it´s not the case.

:oops: I must confess that the original idea is not having to walk (aprox 12 mts) to get the printed paper in a PC in other room if I can see the content of a file trough the LAN.

Also, it´s not a bad idea to have a file copy since sometimes the paper gets stuck and doesn´t print at all.

Thanks again.

Saludos.
Remember: [b][i]"pecunia pecuniam parere non potest"[/i][/b]

User avatar
Burn_IT
Posts: 3650
Joined: Sat 12 Aug 2006, 19:25
Location: Tamworth UK

#7 Post by Burn_IT »

I think the print to file and then print the file is the way to do it.

One extra advantage is that you could delay the printing and do them all together later to save changing paper in the printer.
"Just think of it as leaving early to avoid the rush" - T Pratchett

Keisha
Posts: 469
Joined: Tue 18 Nov 2014, 05:43

re: How to print to both file and paper in MS-DOS?

#8 Post by Keisha »

Perhaps this page may provide clues:

http://ss64.com/nt/syntax-redirection.html

commandA && commandB Run commandA, if it succeeds then run commandB
echo "June_statements printing failed" > D:\June_log.txt && print_monthly.exe June_statements.xls && echo "June_statements printing succeeded" > D:\June_log.txt

and/or maybe this page

https://technet.microsoft.com/en-us/lib ... 90909.aspx

for % in (June_statements July_statements) do print_monthly.exe %.xls && echo "%.xls printing succeeded" > D:\%-success.txt

Sorry, my DOS is awfully rusty. Maybe something like

LPT1 < print_monthly.exe June-billings.xls > D:\June-logfile.txt

might work.

Another page:
http://stackoverflow.com/questions/7119 ... atch-files

You can also create a "generic/text only" printer in Windows and maybe print to that

print_monthly.exe June-billings.xls LPT1 && print_monthly.exe June-billings.xls PRN_GENERIC

User avatar
Galbi
Posts: 1098
Joined: Wed 21 Sep 2011, 22:32
Location: Bs.As. - Argentina.

#9 Post by Galbi »

For those who got involved in this, first: thanks and second, if I didn´t continued it's because I've been very busy this days.
But I'm still interested, so I'll report if any succes or ask if doubts.

Now it's personal...
Remember: [b][i]"pecunia pecuniam parere non potest"[/i][/b]

User avatar
Moose On The Loose
Posts: 965
Joined: Thu 24 Feb 2011, 14:54

Re: How to print to both file and paper in MS-DOS?

#10 Post by Moose On The Loose »

Galbi wrote:I've spent the hole day with this "caprice".

Thou it's very easy to do it in *nix, unfortunately I need it in Windows.

I'd like to have everything that is printed in a dot matrix printer (that hangs from a Win XP) to be printed in paper AND printed to a file. It's some kind of back-up of what it's printed.

The software is a good old DOS program which does not have the option to choose where to print, but it easy to redirect the printing to a file with SET PRINTER=
But I want both, file and paper.

Any ideas?

Thanks.
Back in the mists of time, the easy way to make a program that did this was to capture the interrupt vector for printing. A little TSR[1] program would take over handling of bytes sent to the printer.

A better option for today may be to run the DOS program under dosemu on a Linux box. This way the DOS program will see a faked printer,


[1] Terminate and Stay Resident

Post Reply