Get default printer name from command line?

前端 未结 7 1191
盖世英雄少女心
盖世英雄少女心 2020-12-31 08:02

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:

<
相关标签:
7条回答
  • 2020-12-31 08:13

    i found mine in the sideXside folder...

    C:\windows\winsxs\x86_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_6.1.7600.16385_en-us_0e83b619ada3e7ed\

    i ran the following: cscript C:\windows\winsxs\x86_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_6.1.7600.16385_en-us_0e83b619ada3e7ed\prnmngr.vbs -g

    it worked.

    0 讨论(0)
  • 2020-12-31 08:13

    Using a batch file (no VBScript files):

    @echo off
    
    ::Get printer CLSID
    for /f %%a in ('reg query HKCU\Printers\Defaults') do (set regkey=%%a)
    ::Get printer name from the previous CLSID
    
    for /f "tokens=3*" %%a in ('reg query %regkey%') do (set printername=%%a %%b)
    echo Printer name is: %printername%
    

    I wish that could help you

    0 讨论(0)
  • 2020-12-31 08:19

    To remove printer in Windows 8.1:

    cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -d -p "Printer name"
    

    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!"

    0 讨论(0)
  • 2020-12-31 08:27

    To list active printer components on Windows 8.1:

    c:>cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -l | findstr "Printer name"

    enter image description here

    0 讨论(0)
  • 2020-12-31 08:29

    In Windows 7 these same scripts are found in

    C:\Windows\System32\Printing_Admin_Scripts\en-US
    
    0 讨论(0)
  • 2020-12-31 08:29

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

    cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -g
    

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

    0 讨论(0)
提交回复
热议问题