How to Print Files via WinBatch using
"Spool MS-DOS Print Jobs" in Control Panel
Keywords: print spooling printing
Question:
I have written a small batch file to "run" our plotter. We print to file from CAD, then use my batch file to
record an invoice before sending the file(s) to the printer. (AutoCAD is cranky if you print directly to port
so print to file is the only real choice.) Right now I use another shareware program to spool the file(s) to
the plotter. Is it the same to copy directly to the port (LPT1)? This doesn't seem to go through Print
Manager like the spooler does. I'd like to have my batch file to have the "spool" capabilities. Later, I'd like
to be able to direct the file(s) to different printers across a future network. I need this to work on windows
3.x, 95, & NT. This is how I do it now.
:filetoplotter
FileMove("c:\plotcon\out\*.*", "c:\wspool\spool", @FALSE)
I've read the winbatch/wil manual and I just can't seem to grasp this spool/port thing. thanks.
Answer:
The FileMove / FileCopy sends the print file directly to the hardware port, bypassing (and sometimes
potentially interferring with) the windows print spooler entirely.
WinBatch cannot (currently) simply hand a file over to the print spooler to have it print the job. A quick
glance at the Printer API's indicate there is a fair chance it should not be totally impossible to via a series of
DLLCalls...
Then I took a stab at trying to do it via DllCalls. I can see why it has not been done yet. The code got worse
and worse. Still does not work.
But one of our users offered the following brilliant
suggestion:
Gem from one of our Users, regarding print spooling via DOS....
I noticed that my Windows 95 print manager under properties, details, port settings, has the check box
"Spool MS-DOS Print Jobs". I tried this with the enclosed code, and it seems to work through print
manager just fine. This backdoor approach should be fine for my little batch file.
coms = Environment("COMSPEC")
Run(coms, "/c copy c:\plotcon\out\*.hp2 LPT1")
Article ID: W13696
Filename: Print Spooling - A Trick via DOS in Win95.txt
File Created: 1999:04:15:16:55:46
Last Updated: 1999:04:15:16:55:46