If you wish to change the default printer on a users Windows box via a script, defprint is what you need. Stuart Anderson wrote this fine piece of freeware; however, the site referenced in the file is not available. We put a copy up on NetAdminTools here. Use defprint /P to list your printers:
C:>defprint /P Found 4 printers PrinterName: mondohplaser ServerName: (null) PortName: mondohplaser DriverName: HP LaserJet 1200 Series PCL PrintProcessor: WinPrint ShareName: (null) PrinterName: hpdj ServerName: (null) PortName: LPT1: DriverName: HP DeskJet 672C PrintProcessor: WinPrint ShareName: (null) PrinterName: Generic / Text Only ServerName: (null) PortName: FILE: DriverName: Generic / Text Only PrintProcessor: WinPrint ShareName: (null) PrinterName: Fax ServerName: (null) PortName: SHRFAX: DriverName: Microsoft Shared Fax Driver PrintProcessor: WinPrint ShareName: (null) C:> |
Use defprint /D to set the default printer:
C:>defprint /D mondohplaser Found 4 printers Changing default printer... C:>defprint /D LPT1: Found 4 printers Changing default printer... C:> |
We tested this on XP, and since this utility was written back in ’98, we’d guess it will work on a wide variety of systems. One application that this is good for is if a rogue app changes the default printer. Just change the way the user starts the rogue app by using a batch file with the last line as a defprint command that switches the default printer back. Likewise, if certain applications should print by default to, say, a check printer, you could use the same technique, only put a line in the beginning and the end of the batch file.