Creating a Fake Printer (/dev/null for Windows)
Wednesday, January 14, 2009
These directions will create a printer in Windows that will receive print jobs and then automatically delete them. This is probably only going to be useful for one in a million situations but I thought it was an interesting exercise none the less. If anyone does find this useful, I'd be interested to hear about it.
The reason I did this was because a program was hard coded that when you press the print icon, it would print. Then it would ask you if you wanted to print and select a which printer to print to. It would cause pages to be printed twice, and no matter where you wanted to print, they would go to your default. So I changed the default to just dump them using the Windows NUL function which works the same as /dev/null in Linux.
- Open up your printers and go to "Add Printer"
- Add it as a local printer and uncheck "Automatically Detect"
- Click on "Create a new port:"
- Choose "Local Port"
- The port name is "nul" (yes one "l")
- Name the printer Printer of Death (or whatever you want)
Test it by printing something out. A better test to believe that "nul" works is to run this from command line:
Normally this would print out to a file named "nul" if the concept of nul didn't work
Labels: hack, system administration
These directions will create a printer in Windows that will receive print jobs and then automatically delete them. This is probably only going to be useful for one in a million situations but I thought it was an interesting exercise none the less. If anyone does find this useful, I'd be interested to hear about it.
The reason I did this was because a program was hard coded that when you press the print icon, it would print. Then it would ask you if you wanted to print and select a which printer to print to. It would cause pages to be printed twice, and no matter where you wanted to print, they would go to your default. So I changed the default to just dump them using the Windows NUL function which works the same as /dev/null in Linux.
- Open up your printers and go to "Add Printer"
- Add it as a local printer and uncheck "Automatically Detect"
- Click on "Create a new port:"
- Choose "Local Port"
- The port name is "nul" (yes one "l")
- Name the printer Printer of Death (or whatever you want)
Test it by printing something out. A better test to believe that "nul" works is to run this from command line:
Normally this would print out to a file named "nul" if the concept of nul didn't work
Labels: hack, system administration