[System] adds/deletes virtual printers and virtual printers in windows.

Source: Internet
Author: User

[System] adds/deletes virtual printers and virtual printers in windows.

Because the project needs to add multiple virtual printers to the windwos system (which can print the paper normally), find out the system function.

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

Usage: rundll32 printui. dll, PrintUIEntry [options] [@ commandfile]/a [file] binary file name/B [name] basic printer name/c [name] if the operation is performed on a remote machine, unc machine name/dl Delete local printer/dn Delete Network Printer connection/dd delete printer driver/e display print preferences/f [file] inf file or output file specified by/f the INF file may depend on the/F [file] Location of the INF file/ga to add a printer connection for each machine (this connection will be propagated to the user upon user login) /ge enumerate printer connections on each machine/gd delete printer connections on each machine (this connection will be deleted upon user login)/h [arch] driver architecture, which is one of the following: x86, x64, or Itanium/ia. Use the INF file to install the Printer Driver/id. Printer Driver/if use INF file to install Printer/ii Use Add Printer with INF file Wizard to install Printer/il use Add Printer Wizard to install Printer/in add Network Printer connection/ip Use Network printer Installation Wizard installation printer/j [provider] print provider name/k print the test page to the specified printer, command combination when the printer cannot be installed/l [path] printer driver source path/m [model] printer driver model name/n [name] printer name/o display printer queue View /p display printer properties/q quiet mode, no error message displayed/r [port] port name/s Display Server properties/Ss save printer settings to a file/Sr restore printer settings save or restore from a file must be placed at the end of the command printer setting option flag: 2PRINTER_INFO_27PRINTER_INFO_7c color configuration file d Printer data s security descriptor g Global DevModem minimum settings U user DevModer resolves Name Conflict f force name p resolution port I driver name conflict/u if installed, use the existing Printer Driver/t [#] to start with the zero-based index page/v [version] driver version, which is one of the following: "Type 2-kernel mode" or "Type 3-user mode"/w if the specified driver cannot be found in INF, the user/y is prompted to set the printer to the default printer/Xg to get the printer settings/Xs set the printer settings/z do not share the printer automatically/Z do not generate the printer name/K change/h meaning, make x86, x64, or Itanium accept 2, 3, and 4, and change/v meaning so that "Type 3-user mode" accepts 3/Z share this printer, it can only be used with the/if option /? Help Info @ [file] command line parameter file/Mw [message] display warning message before confirmation command/Mq [message] display confirmation message before confirmation command/W [flags] specify wizard (APW and APDW) to enable the Wizard to restart/G [flags] from the previous page to specify the global flag and switch w to suppress the installer driver warning UI (super quiet mode) for example: running Server property: rundll32 printui. dll, PrintUIEntry/s/t1/c \ machine run printer attributes: rundll32 printui. dll, PrintUIEntry/p/n \ machine \ printer run the Add printer wizard locally: rundll32 printui. dll, PrintUIEntry/il at \ machine: rundll32 printui. dll, PrintUIEntry/il/c \ Machine run Add Printer wizard run queue view: rundll32 printui. dll, PrintUIEntry/o/n \ machine \ printer run INF installation: rundll32 printui. dll, PrintUIEntry/if/B "Test Printer"/f c: \ infpath \ infFile. inf/r "lpt1:"/m "Brother DCP-128C" run the INF installation (with INF dependency ). In this example, prnbr002.inf depends on ntprint. infrundll32 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 to run the Add Printer Wizard: rundll32 printui. dll, PrintUIEntry/ii/f c: \ infpath \ infFile. inf use the built-in printer driver to add the printer: rundll32 printui. dll, PrintUIEntry/if/B "Test Printer"/r "lpt1:"/m "Brother DCP-128C" add each machine Printer connection (this connection will be propagated to the user upon user login ): rundll32 printui. Dll, PrintUIEntry/ga/c \ machine/n \ machine \ printer/j "LanMan Print Services" Delete the printer connection for each machine (this connection will be deleted upon user login ): rundll32 printui. dll, PrintUIEntry/gd/c \ machine/n \ machine \ printer enumerate the printer connection of each machine: rundll32 printui. dll, PrintUIEntry/ge/c \ machine use INF to 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. use inf to add a print Driver: rundll32 printui. dll, PrintUIEntry/ia/K/c \ machine/m "Brother DCP-128C"/h "x86"/v 3 add built-in printer driver: rundll32 printui. dll, PrintUIEntry/ia/c \ machine/m "Brother DCP-128C"/h "Intel"/v "Type 3-Kernel Mode" delete printer driver: rundll32 printui. dll, PrintUIEntry/dd/c \ machine/m "Brother DCP-128C"/h "x86"/v "Type 3-User Mode" delete printer driver: rundll32 printui. dll, PrintUIEntry/dd/K/c \ machine/m "Brother DCP-128C"/h "x86"/v 3 set the printer to the default printer: rundll32 printui. dll, PrintUIEntry/y/n "printer" to set the printer annotation: rundll32 printui. dll, PrintUIEntry/Xs/n "printer" comment "My Cool Printer" Get printer settings: rundll32 printui. dll, PrintUIEntry/Xg/n "printer" to get the result of saving the printer settings in the file: rundll32 printui. dll, PrintUIEntry/f "results.txt"/Xg/n "printer" set printer settings command: rundll32 printui. dll, PrintUIEntry/Xs/n "printer "? Save all printer settings to one file: rundll32 printui. dll, PrintUIEntry/Xs/n "printer "? Restore all printer settings from a file: rundll32 printui. dll, PrintUIEntry/Sr/n "printer"/a "file. dat "saves the second-level printer information to a file: rundll32 printui. dll, PrintUIEntry/Ss/n "printer"/a "file. dat "2 restore the printer security descriptor from a file: rundll32 printui. dll, PrintUIEntry/Sr/n "printer"/a "file. dat "s restores the global devmode and printer data from a file: rundll32 printui. dll, PrintUIEntry/Sr/n "printer"/a "file. dat "g d restores and analyzes the port name from the file at least: 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 printer client rendering: rundll32 printui. dll, PrintUIEntry/Xs/n "printer" ClientSideRender disabled

To add a printer, first check whether the local port exists on the printer page of the control panel. The virtual port that can be printed normally is (NUL :). If it does not exist, you need to manually create it.

@ Echo offREM add 5 printers named TestPrt1-TestPrt5 use port as NUL: use the printer set num = 5for/l % I in (1 1% NUM %) do rundll32 printui for the Brother DCP-116C. dll, PrintUIEntry/if/B "TestPrt % I"/r "NUL:"/m "Brother DCP-116C" pause

Delete a printer

@ Echo offREM delete five printers named TestPrt1-TestPrt5 set num = 5for/l % I in (1 1% NUM %) do rundll32 printui. dll, PrintUIEntry/dl/n "TestPrt % I" pause

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.