Powered by GeSHi

Source code for getprnnt.bat

(view source code of getprnnt.bat as plain text)

  1. @ECHO OFF
  2. :: GetPrn.bat,  Version 1.01
  3. :: Displays network printers plus default
  4. :: printer for current user on current system.
  5. :: Written for multi-vendor networks using NetBIOS.
  6. :: Use GetPrn2.bat for "real" NT/2000 networks.
  7. :: Requires REG.EXE from the Microsoft Windows NT 4 Resource Kit
  8. ::
  9. :: Written by Rob van der Woude
  10. :: http://www.robvanderwoude.com
  11.  
  12. SETLOCAL
  13. ECHO Default printer defined for %username%:
  14. FOR /F "tokens=3* delims=]," %%A IN ('REG QUERY HKCU\Printers\Connections ^| FIND /V "Listing" ^| find "["') DO ECHO.  %%A
  15. ECHO Network printers defined on %computername%:
  16. :: Delims is a TAB followed by a space
  17. FOR /F "tokens=3* delims=	 " %%A in ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Print\Providers\LanMan Print Services\Servers" /S ^| FIND "Share Name"') DO ECHO.  %%B
  18. ECHO.
  19. ENDLOCAL
  20. GOTO:EOF
  21.