Thursday, April 23, 2009

Print to a network printer from Ant task on Windows..


I wanted to print a checklist as the final task in a release management Ant job.
We have a predominantly windows environment on the desktop, so I thought I'd try using the DOS print command, but was initially foiled when trying to use a network printer.
I was then mislead slightly by this: NET USE LPT1: \\MY_SERVER\PRINTER which I found here.
In the end the obvious solution (to use the share name for the device) was the right one.
Reproduced below, it works a dream, now you too can spam your office printers!

<exec executable="print">
<arg value="/D:\\dundonald01\panasoni"/>
<arg value="${doc.dir}\checklist.txt"/>
</exec>


Comments:

a said...

Seriously? Print something? Why not save the paper/trees and just send an email?

Unknown said...

Well perhaps it is a bit insane!

I want release managers to really have an actual check list they can check tasks off on.

Perhaps I should laminate one and we could reuse it.

I guess I got carried away with the idea of printing stuff, nostalgic for the teleprinter & the punched card. Those were the days! ;-)

blog comments powered by Disqus

I know nothing, I'm not a fortune teller, and you'd be insane to think that I am. This disclaimer was cribbed from an email footer I once received. It is so ridiculous I had to have it for myself.

Statements in this blog that are not purely historical are forward-looking statements including, without limitation, statements regarding my expectations, objectives, anticipations, plans, hopes, beliefs, intentions or strategies regarding the future. Factors that could cause actual results to differ materially from the forward looking statements include risks and uncertainties such as any unforeseen event or any unforeseen system failures, and other risks. It is important to note that actual outcomes could differ materially from those in such forward-looking statements.

Danny Angus Copyright © 2006-2013 (OMG that's seven years of this nonsense)