21.08.2019»»среда

Set Default Printer Command Line

21.08.2019
    33 - Comments

The problem with this approach is that it disables color all together, from what I can gather. It also did not work for my PCL driver, only PS. Checking printer properties/preferences will still show a default value of Auto Color (aka disabling color won't reflect). At the very least, if you want to prevent users from printing color, this could help.

  1. Set Default Printer Command Line Windows
  2. Set Default Printer In Windows 8.1
  3. Set Default Printer Command Line Download
Learning has never been so easy!

I ran into this issue on a client XP box that had their user account locked from 'right-clicking'. That is the easiest way to set the default printer, (right click and set as default printer), but this was not doable since their account was locked from right clicking. Also, since setting default printers are user profile specific, it was not as easy as setting the default printer with an admin account and that carryover to the regular user account. Rather than adjust the security settings to allow right clicking, I found a cmd line command that would set the default printer under the restricted user account.

3 Steps total

Step 1: Log in as the user you want to adjust the default printer for

Step 2: Open CMD prompt

Step 3: Type in: RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n 'printer'

for example:

RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n 'HP Officejet Pro 8500'

Published: Oct 31, 2011 · Last Updated: Jan 17, 2018

15 Comments

  • Tabasco
    DevonSchreiner Oct 31, 2011 at 11:47am

    That would have come in handy this summer when I was running around to everyone's computer to do this... Thanks for the how-to all the same!

  • Tabasco
    SIR Oct 31, 2011 at 12:35pm

    That is useful. However I do find it interesting that they do not have a right+click permission, yet they can use the run command.

  • Pimiento
    Li0nel Oct 31, 2011 at 02:36pm

    I had to do this to over 300 workstations last year. I created a batch file and then ran it. Opened it changed the pc name/printer and ran again etc. This will install a printer and make it the default for all new users who log onto the pc. Make sure you you delete my comments about adding and deleting before putting it into a batch file :)

    ga=global add printer
    gd=global delete printer

    rundll32 printui.dll,PrintUIEntry /ga /cCOMPUTER_NAME /n'PRINTSERVERPRINTERNAME' -- instal printer

    rundll32 printui.dll,PrintUIEntry /gd /cCOMPUTER_NAME /n'PRINTSERVERPRINTERNAME' -- instal printer

    sc COMPUTER_NAME stop spooler

    sc COMPUTER_NAME start spooler

    pause

    I put the pause in to check that it worked. You can add as many pc's/printer to the batch file that you want. I did it for a regular printer and then a printer for RX. If I knew programing I would simply create a box that prompts for which pc and which printer to install. You can also run this from a command prompt.

  • Serrano
    tech_freak Dec 15, 2011 at 02:20pm

    Thats a nice tip.

  • Pimiento
    Floyd4783 Aug 8, 2013 at 04:49pm

    This is the first thing I found that actually works on Windows 7. LIFESAVER!

  • Pimiento
    dph23 Apr 8, 2014 at 10:19am

    Thanks to Li0nel, great tip, this is the first thing I have found that works on Win7 for adding printers for all users.

  • Jalapeno
    Chad13 Sep 12, 2014 at 04:44pm

    I know this is old, but Li0nel did you run this on each machine?

  • Sonora
    Chad7777 Nov 13, 2014 at 10:02pm

    you could at a SET Variable and the batch file would allow you to type in the computer name and then it would put the computer name in the correct spot for you....Like This

    echo off
    echo please type the computer name for script to run on
    set /p name= :
    echo.
    rundll32 printui.dll,PrintUIEntry /ga /c%name%

  • Sonora
    Chad7777 Nov 13, 2014 at 10:12pm

    you could take it farther and create a loop so you dont have to re open....All though this you might have to play with but here is the concept

    echo off
    goto start
    :start
    echo please type the computer name for script to run on
    set /p name= :
    echo.
    rundll32 printui.dll,PrintUIEntry /ga /c%name%
    goto start

  • Pimiento
    barryharkin May 21, 2017 at 07:24am

    I am trying (without success) to create a Windows 10 cmd file to switch between Home and Work printers.
    The cmd file follows ... any assistance would be greatly appreciated

    @echo off

    @echo off
    echo ---------------------------------------------------------
    echo Set Default Printer - Home or Work
    echo ---------------------------------------------------------
    echo .
    echo .

    echo Enter your location (H W)
    set /p location=
    echo .
    echo .

    IF /i '%location%'H' goto LocationHome
    IF /i '%location%'W' goto LocationWork

    echo Not found.
    goto commonexit

    :LocationHome
    RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n 'Prt-Home'
    echo Default Printer Set - Home
    goto commonexit

    :LocationWork
    RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n 'Prt-Work'
    echo Default Printer Set - Work
    goto commonexit

    :commonexit
    pause.

  • Pimiento
    davidbeans Aug 2, 2017 at 12:50am

    I'm not a computer genius but not completely ignorant either.
    I open up Command prompt and It comes up C:Docments and SettingsUser1> I typed: RUNDLL32PRINTUI.DLL,PrintUIEntry/y/n'Brother MFC-L2720DW'. I get an error message 'not recognized as an internal or external command.

    Any help? Thanks!

  • Pimiento
    ZekeXeno Aug 8, 2017 at 10:47pm

    davidbeans

    Make sure all the spaces are present (after the following: RUNDLL32 & PRINTUI.DLL,PrintUIEntry & /y & /n ).

  • Sonora
    kelzipan Mar 23, 2018 at 06:53pm

    Still useful in 2018 for Win 7. Thanks for this tip! I work for multiple locations so I set my default printer to a PDF printer so I don't things at random places. Occasionally I'm working in an older software that lets me print screen to a default printer and this is a fast toggle! Love time saving!

  • Anaheim
    m0nkey Jul 6, 2018 at 03:50pm

    This was very useful, thank you. I really wish they would add the ability to change the default printer in the Print Management interface, but for now this + invoke+command in powershell should do.

    Thank you!

  • Serrano
    Hillary3099 Jul 25, 2018 at 11:36am

    I am trying to use this in a remote desktop environment, it works if well one printer at a time. What I would like to do is create a batch file. and set up the printer as a variable, either pulled from a spreadsheet by username or, even better, from one of the unused fields in active directory (I'm thinking of using PO box.)
    Anyone know how to do this?

Microsoft Windows XP comes with a VBS script to manage local and network printers from the command line:

To Get the default printer details from command line:

To Get the list of printers added to the system from Windows command line:

Is there any equivalent commands for Windows 7? I just need to get the default printer details and get the list of printers attached to the system.

Bali C
23.3k32 gold badges99 silver badges137 bronze badges
KimiKimi
3983 gold badges7 silver badges18 bronze badges

6 Answers

Bali CBali C
23.3k32 gold badges99 silver badges137 bronze badges

i found mine in the sideXside folder...

C:windowswinsxsx86_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_6.1.7600.16385_en-us_0e83b619ada3e7ed

Rem set printer as default

i ran the following:cscript C:windowswinsxsx86_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_6.1.7600.16385_en-us_0e83b619ada3e7edprnmngr.vbs -g

it worked.

Rich701Rich701

To list active printer components on Windows 8.1:

c:>cscript C:WindowsSystem32Printing_Admin_Scriptsen-USprnmngr.vbs -l findstr 'Printer name'

J. Chomel
6,29813 gold badges34 silver badges53 bronze badges
codesnipercodesniper

List of all printers names and shows default one (You can get more details read documentation)

Set Default Printer Command Line Windows

If you want output to file use:

Availability

The wmic command is an external command that is available in the below Microsoft operating systems as wmic.exe.

Maciej PulikowskiMaciej Pulikowski
1,7212 gold badges5 silver badges23 bronze badges

Set Default Printer In Windows 8.1

To remove printer in Windows 8.1:

Set Default Printer Command Line Download

I had trouble with a printer not showing in devices/printers so unable to remove it, although it was there when I pressed file > print in firefox. It was also stopping me from using the printer name for the actual installation (it bugged me having to append _1 at the end of the default printer!'

Lloyd MedleyLloyd Medley
Set Default Printer Command Line

On Windows 10, the scripts are found in the same place as Windows 7.Execute the following command to display the default printer.

Note if there is no default printer, the script will return nothing

CefoussaCefoussa

Not the answer you're looking for? Browse other questions tagged windowswindows-7 or ask your own question.