Sunday, April 30, 2006

Change default printer via command line

An old application I still need to use has no way of printing to a printer other than the Windows default. It is the only program that we need to print on an ink jet with form paper. All other applications usually print on a laser.

In order not to have to change the default printer manually before starting that application I wrapped it up in a little batch file. It changes the default printer appropriately with this command line:

@RunDLL32.EXE printui.dll,PrintUIEntry /y /n "Canon i560"

The printer name has to be the value displayed in the control panel.

All available options can be displayed like this:

RunDLL32.EXE printui.dll,PrintUIEntry /?

No comments: