My Photo Danny Angus

Head of Innovation at DriveBusiness

"start apache anyway. There's stuff, yeah, apparently"

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:

Jon Scott Stevens said...

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

Danny Angus 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

Danny Angus Copyright © 2009