Set Default Printer Via Command Line

Thought this was handy, considering Windows XP likes to randomly change the default printer sometimes. You can use this command in a batch file, script, or whatever in windows to change/set the default printer: 

rundll32 printui.dll,PrintUIEntry /y /q /n “Printer name”

-Dave out

About these ads

18 thoughts on “Set Default Printer Via Command Line

  1. We’re trying to batch set a default printer.
    If my printers are network would this be correct?

    rundll32 printui.dll,PrintUIEntry /y /q /n\\server\XeroxBlack

    I was wondering where one would place the file after it is created. Do I do this on the server or on each of the computers?

  2. When you type rundll32 printui.dll,PrintUIEntry /? you get a list of valid commands. That command you typed seems to be correct, but I haven’t used the command in that way. I have only used it to set a default printer that was already locally installed on the PC.

    As far as where to place it, that depends on how your network is set up. Do you use login scripts for your users? If so, and they are .bat and not .vbs scripts, then add it there. Otherwise you’d have to but a bat with that command in the startup of every PC.

  3. This is great and all but is there an option to set the printer you are installing as the default. I called up the help on this but cannot find that one option. Any help would be appreciated.

  4. Not sure, I’ve only used this command to set an existing printer as the default. Not to install a new printer.

    You could run a command to install a printer and then right after it in the batch, have this line default it. You’d just need to get the printer name right.

    Hope that helps.

  5. Many Many thanks to all of you for solve my problem. This code you submit is really working. I am working on Network PC. So i wanted to create a batch file which automatically connected the Printer of another Network PC and set it as Default printer. I have created a Batch file which connect the Network Printer and set it as Default Printer. The Code is as Follows

    @ Echo off
    Net use \\192.168.9.30\HPLaserj smile
    rundll32 printui.dll,PrintUIEntry /y /q /n \\192.168.9.30\HPLaserj

    in the above code the ‘smile’ word is Password of Network PC which IP address is ‘\\192.168.9.30′

  6. Glad to help. I often scour google for a quick answer to little tech problems, so when I find something helpful or figure out something cool myself I try to post it here and share the info.

  7. This is awesome, I have been trying to figure out a way to do this in VBS or command line….This will resolve my issue with multiple printer selection changes when a wireless laptop moves from location to location in a hospital environment to print data……THANKS!

  8. A lot of solutions for this kind of questions. But this one is the easyest and perfect solution to change the default printer!!!!!
    Thanks a lot
    Jürg

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s