Append and to windows to remove virtual printer instances tutorial

  • 2020-06-07 05:49:01
  • OfStack

Since the project needs to add multiple virtual printers to the windwos system (able to print paper normally), the system function under 1 is found.

Use rundll32 printui.dll,PrintUIEntry, run in CMD and get the following prompt in the pop-up box.

Usage: rundll32 printui.dll,PrintUIEntry [options] [@commandfile]


/a[file] 2 Base file name 
  /b[name]  Basic printer name 
  /c[name]  If the operation is on a remote machine, unc  The name of the machine 
  /dl  Delete the local printer 
  /dn  Remove network printer connections 
  /dd  Delete the printer driver 
  /e  Displays print preferences 
  /f[file] inf  A file or output file 
   use  /f  The specified  INF  The file may depend on  INF  Of the file  /F[file]  location 
  /ga  Add each machine printer connection ( This connection is propagated to the user when the user logs in )
  /ge  Enumerate each machine printer connection 
  /gd  Delete each machine printer connection ( This connection is deleted when the user logs in )
  /h[arch]  The driver architecture is the following 1: x86  or  x64  or  Itanium
  /ia  with  INF  File installs the printer driver 
  /id  Install the printer driver using the Add Printer Driver wizard 
  /if  with  INF  File installation printer 
  /ii  with  INF  Add printer wizard to file to install printer 
  /il  Install the printer using the Add Printer wizard 
  /in  Add a network printer connection 
  /ip  Use the Network printer setup wizard to install the printer 
  /j[provider]  Print the provider name 
  /k  Prints the test page to the specified printer. The command combination when the printer cannot be installed 
  /l[path]  Printer driver source path 
  /m[model]  Printer driver model name 
  /n[name]  The printer name 
  /o  Display printer queue view 
  /p  Display printer properties 
  /q  Silent mode, no error messages displayed 
  /r[port]  The port name 
  /s  Display server properties 
  /Ss  Save the printer Settings to 1 A file 
  /Sr  from 1 Three files restore printer Settings 

Save or restore the printer Settings option flag that must be placed at the end of the command:


  2  PRINTER_INFO_2
  7  PRINTER_INFO_7
  c   Color profile 
  d   Printer data 
  s   Security descriptor 
  g   global  DevMode
  m   The minimum setting 
  u   The user  DevMode
  r   Resolve name conflicts 
  f   Mandatory use of name 
  p   Parse port 
  i   Driver name conflict 
  /u  If installed, use an existing printer driver 
  /t[#]  A starting zero-based index page 
  /v[version]  The driver version is one of the following 1: "Type  2 -  Kernel mode or type  3 -  User mode" 
  /w  If the  INF  The specified driver cannot be found in, prompt the user 
  /y  Set the printer as the default printer 
  /Xg  Get printer Settings 
  /Xs  Set printer Settings 
  /z  Do not automatically share this printer 
  /Z  Do not automatically generate printer names 
  /K  To change the  /h  The meaning of make  x86  or  x64  or  Itanium  accept  2 , 3 , 4 , and change  /v  The meaning of make "type"  3 -  User mode "accepted  3
  /Z  Share this printer, only with  /if  options 1 The use 
  /?  Help information 
  @[file]  Command line parameters file 
  /Mw[message]  Displays a warning message before confirming the command 
  /Mq[message]  Displays the confirmation message before confirming the command 
  /W[flags]  Specify the wizard (APW  and  APDW) Logo and toggle 
  r   Enables the wizard from above 1 Page restart 
  /G[flags]  Specify global flags and switches 
  w   Suppress setup driver warnings  UI ( Super silent mode )

Such as:

Run server properties:


rundll32 printui.dll,PrintUIEntry /s /t1 /c\\machine
   Run printer properties :
rundll32 printui.dll,PrintUIEntry /p /n\\machine\printer
   Run the Add Printer wizard locally :
rundll32 printui.dll,PrintUIEntry /il
   in  \\machine:
rundll32 printui.dll,PrintUIEntry /il /c\\machine  Run the Add Printer wizard 
   Run queue view :
rundll32 printui.dll,PrintUIEntry /o /n\\machine\printer
   run  INF  The installation :
rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /f c:\infpath\infFile.inf /r "lpt1:" /m "Brother DCP-128C"
   run  INF  The installation ( with  INF  dependencies ) . In this example, prnbr002.inf  Depends on the  ntprint.inf
rundll32 printui.dll, PrintUIEntry /ia /m "Brother DCP-128C" /K /h x64 /v 3 /f "c:\infpath\prnbr002.inf" /F "c:\infpath\ntprint.inf"
   use  INF  Run the Add Printer wizard :
rundll32 printui.dll,PrintUIEntry /ii /f c:\infpath\infFile.inf
   Add a printer using the built-in printer driver :
rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /r "lpt1:" /m "Brother DCP-128C"
   Add each machine printer connection ( This connection is propagated to the user when the user logs in ):
rundll32 printui.dll,PrintUIEntry /ga /c\\machine /n\\machine\printer /j"LanMan Print Services"
   Delete each machine printer connection ( This connection is deleted when the user logs in ):
rundll32 printui.dll,PrintUIEntry /gd /c\\machine /n\\machine\printer
   Enumerate each machine printer connection :
rundll32 printui.dll,PrintUIEntry /ge /c\\machine
   use  INF  Add the printer driver :
rundll32 printui.dll,PrintUIEntry /ia /c\\machine /m "Brother DCP-128C" /h "x86" /v "Type 3 - User Mode" /f c:\infpath\infFile.inf
   use  INF  Add the printer driver :
rundll32 printui.dll,PrintUIEntry /ia /K /c\\machine /m "Brother DCP-128C" /h "x86" /v 3
   Add the built-in printer driver :
rundll32 printui.dll,PrintUIEntry /ia /c\\machine /m "Brother DCP-128C" /h "Intel" /v "Type 3 - Kernel Mode"
   Delete the printer driver :
rundll32 printui.dll,PrintUIEntry /dd /c\\machine /m "Brother DCP-128C" /h "x86" /v "Type 3 - User Mode"
   Delete the printer driver :
rundll32 printui.dll,PrintUIEntry /dd /K /c\\machine /m "Brother DCP-128C" /h "x86" /v 3
   Set the printer as the default printer :
rundll32 printui.dll,PrintUIEntry /y /n "printer"
   Set printer annotations :
rundll32 printui.dll,PrintUIEntry /Xs /n "printer" comment "My Cool Printer"
   Get printer Settings :
rundll32 printui.dll,PrintUIEntry /Xg /n "printer"
   Gets the result of saving printer Settings in the file :
rundll32 printui.dll,PrintUIEntry /f "results.txt" /Xg /n "printer"
   Set printer setup command to use :
rundll32 printui.dll,PrintUIEntry /Xs /n "printer" ?
   Save all printer Settings 1 A file :
rundll32 printui.dll,PrintUIEntry /Xs /n "printer" ?
   from 1 Three files restore all printer Settings :
rundll32 printui.dll,PrintUIEntry /Sr /n "printer" /a "file.dat"
   will 2 Level I printer information is stored 1 A file :
rundll32 printui.dll,PrintUIEntry /Ss /n "printer" /a "file.dat" 2
   from 1 File restore printer security descriptor :
rundll32 printui.dll,PrintUIEntry /Sr /n "printer" /a "file.dat" s
   from 1 Restore printer global  devmode  And printer data :
rundll32 printui.dll,PrintUIEntry /Sr /n "printer" /a "file.dat" g d
   Restore and parse port names from files with minimum Settings :
rundll32 printui.dll,PrintUIEntry /Sr /n "printer" /a "file.dat" m p
   Enable printer client rendering :
rundll32 printui.dll,PrintUIEntry /Xs /n"printer" ClientSideRender enabled
   Disable client rendering for printers :
rundll32 printui.dll,PrintUIEntry /Xs /n"printer" ClientSideRender disabled

Add the printer step by first confirming the existence of a local port in the printer page of the control panel. The virtual port that can print normally is (NUL :), if it does not exist, you need to create it manually.


@echo off 
REM  add 5 Table name for  TestPrt1-TestPrt5  Use port as  NUL:  Use drive as  Brother DCP-116C  The printer 
SET NUM=5
for /l %%i in (1 1 %NUM%) do rundll32 printui.dll,PrintUIEntry /if /b "TestPrt%%i" /r "NUL:" /m "Brother DCP-116C"
pause

Delete printer


@echo off
REM  Delete the named TestPrt1-TestPrt5 the 5 printer 
SET NUM=5
for /l %%i in (1 1 %NUM%) do rundll32 printui.dll,PrintUIEntry /dl /n "TestPrt%%i"
pause

Related articles: