(view source code of getprn2nt.bat as plain text)
@ECHO OFF
:: GetPrn2.bat, Version 1.00
:: Displays network printers plus default
:: printer for current user on current system.
:: Written for "real" NT/2000 networks.
:: Requires REG.EXE from the Microsoft Windows NT 4 Resource Kit
::
:: Written by Rob van der Woude
:: http://www.robvanderwoude.com
SETLOCAL
ECHO.
:: Delims is a comma, followed by a TAB and a space
FOR /F "tokens=3* delims=, " %%A IN ('REG QUERY "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"') DO ECHO Default Printer %%A
ECHO.
ECHO Printers defined on %computername%:
FOR /F "skip=1 tokens=*" %%A IN ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers" ^| FIND "["') DO CALL :Enum "%%A"
ENDLOCAL
GOTO:EOF
:Enum
ECHO.
SET Printer=%1
SET Printer=%Printer:"=%
SET Printer=%Printer:[=%
SET Printer=%Printer:]=%
:: Delims is a TAB followed by a space
FOR /F "tokens=2* delims= " %%a IN ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\%Printer%\Name"') DO ECHO Name %%b
FOR /F "tokens=2* delims= " %%a IN ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\%Printer%\Description"') DO ECHO Description %%b
FOR /F "tokens=3* delims= " %%a IN ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\%Printer%\Printer Driver"') DO ECHO Printer Driver %%b
FOR /F "tokens=2* delims= " %%a IN ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\%Printer%\Port"') DO ECHO Port %%b
GOTO:EOF
page last modified: 2024-04-16; loaded in 0.0092 seconds