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:
<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.
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
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!"
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"
In Windows 7 these same scripts are found in
C:\Windows\System32\Printing_Admin_Scripts\en-US
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