Tip: создаем null-принтер
|
|
|
Понедельник, 19 Июнь 2006 | (12197)
Бывают моменты, когда в некоторых программах предусмотренная принудительная печать, при выполнении какого-либо действия. Но часто бывает так, что надо совершить такое действие, но тратить бумагу на печать не надо.. Именно для таких моментов и существуют null-принтеры... Суть null-принтера в том, что для программы он существует, и програма на нем печатает, но печать никуда не выводится.. Документ просто уходит в никуда (во блин прикол - тут закон Ейнштейна недействует :)) )
Для создания такого принтера можно использовать вот такой скрипт:
NULprt.bat:
@echo on
:: Register the prnadmin.dll
regsvr32 /s "C:\Program Files\Windows Resource Kits\Tools\prnadmin.dll"
:: Add a local NUL port
cscript //nologo "C:\Program Files\Windows Resource Kits\Tools\portmgr.vbs" -a -p NUL -t local
:: Add the "Generic / Text Only" driver
cscript //nologo "C:\Program Files\Windows Resource Kits\Tools\drvmgr.vbs" -a -i %SystemRoot%\inf\ntprint.inf -m "Generic / Text Only"
:: Add the NUL printer using the local NUL port and the "Generic / Text Only" driver
cscript //nologo "C:\Program Files\Windows Resource Kits\Tools\prnmgr.vbs" -a -f %SystemRoot%\inf\ntprint.inf -m "Generic / Text Only" -b NUL -r NUL
Для того, чтобы данный скрипт работал, нужно скачать Windows Server 2003 Resource Kit tools.
Скачать такую штуку стоит хотя-бы посмотрев на то, что там есть:
Acctinfo.dll (documented in Readme.htm)
Adlb.exe: Active Directory Load Balancing Tool
Admx.msi: ADM File Parser
Atmarp.exe: Windows ATM ARP Server Information Tool
Atmlane.exe: Windows ATM LAN Emulation Client Information
Autoexnt.exe: AutoExNT Service
Cdburn.exe: ISO CD-ROM Burner Tool
Checkrepl.vbs: Check Replication
Chklnks.exe: Link Check Wizard
Chknic.exe: Network Interface Card Compliance Tool for Network Load Balancing
Cleanspl.exe: Spooler Cleaner
Clearmem.exe: Clear Memory
Clusdiag.msi: Cluster Diagnostics and Verification Tool
Clusfileport.dll: Cluster Print File Port
Clusterrecovery.exe: Server Cluster Recovery Utility
Cmdhere.inf: Command Here
Cmgetcer.dll: Connection Manager Certificate Deployment Tool
Compress.exe: Compress Files
Confdisk.exe: Disk Configuration Tool
Consume.exe: Memory Consumers Tool
Creatfil.exe: Create File
Csccmd.exe: Client-Side Caching Command-Line Options
Custreasonedit.exe: Custom Reason Editor (documented in Readme.htm)
Delprof.exe: User Profile Deletion Utility
Dh.exe: Display Heap
Diskraid.exe: RAID Configuration Tool
Diskuse.exe: User Disk Usage Tool
Dnsdiag.exe: SMTP DNS Diagnostic Tool (documented in Readme.htm)
Dumpfsmos.cmd: Dump FSMO Roles
Dvdburn.exe: ISO DVD Burner Tool
Empty.exe: Free Working Set Tool
Eventcombmt.exe: Check Replication
Fcopy.exe: File Copy Utility for Message Queuing
Frsflags.vbs
Getcm.exe: Connection Manager Profile Update
Gpmonitor.exe: Group Policy Monitor
Gpotool.exe: Group Policy Objects
Hlscan.exe: Hard Link Display Tool
Ifilttst.exe: IFilter Test Suite
Ifmember.exe: User Membership Tool
Inetesc.adm: Internet Explorer Enhanced Security Configuration
Iniman.exe: Initialization Files Manipulation Tool
Instcm.exe: Install Connection Manager Profile
Instsrv.exe: Service Installer
Intfiltr.exe: Interrupt Affinity Tool
Kerbtray.exe: Kerberos Tray
Kernrate.exe: Kernel Profiling Tool
Klist.exe: Kerberos List
Krt.exe: Certification Authority Key Recovery
Lbridge.cmd: L-Bridge
Linkd.exe
Linkspeed.exe: Link Speed
List.exe: List Text File Tool
Lockoutstatus.exe: Account Lockout Status (documented in Readme.htm)
Logtime.exe
Lsreport.exe: Terminal Services Licensing Reporter
Lsview.exe: Terminal Services License Server Viewer
Mcast.exe: Multicast Packet Tool
Memmonitor.exe: Memory Monitor
Memtriage.exe: Resource Leak Triage Tool
Mibcc.exe: SNMP MIB Compiler
Moveuser.exe: Move Users
Mscep.dll: Certificate Services Add-on for Simple Certificate Enrollment Protocol
Nlsinfo.exe: Locale Information Tool
Now.exe: STDOUT Current Date and Time
Ntimer.exe: Windows Program Timer
Ntrights.exe
Oh.exe: Open Handles
Oleview.exe: OLE/COM Object Viewer
Pathman.exe: Path Manager
Permcopy.exe: Share Permissions Copy
Perms.exe: User File Permissions Tool
Pfmon.exe: Page Fault Monitor
Pkiview.msc: PKI Health Tool
Pmon.exe: Process Resource Monitor
Printdriverinfo.exe: Drivers Source
Prnadmin.dll: Printer Administration Objects
Qgrep.exe
Qtcp.exe: QoS Time Stamp
Queryad.vbs: Query Active Directory
Rassrvmon.exe: RAS Server Monitor
Rcontrolad.exe: Active Directory Remote Control Add-On
Regini.exe: Registry Change by Script
Regview.exe (documented in Readme.htm)
Remapkey.exe: Remap Windows Keyboard Layout
Robocopy.exe: Robust File Copy Utility
Rpccfg.exe: RPC Configuration Tool
Rpcdump.exe
Rpcping.exe
RPing: RPC Connectivity Verification Tool
Rqc.exe: Remote Access Quarantine Client
Rqs.exe: Remote Access Quarantine Agent
Setprinter.exe: Spooler Configuration Tool
Showacls.exe
Showperf.exe: Performance Data Block Dump Utility
Showpriv.exe: Show Privilege
Sleep.exe: Batch File Wait
Sonar.exe: FRS Status Viewer
Splinfo.exe: Print Spooler Information
Srvany.exe: Applications as Services Utility
Srvcheck.exe: Server Share Check
Srvinfo.exe: Remote Server Information
Srvmgr.exe: Server Manager
Ssdformat.exe: System State Data Formatter
Subinacl.exe
Tail.exe
Tcmon.exe: Traffic Control Monitor
Timeit.exe (documented in Readme.htm)
Timezone.exe: Daylight Saving Time Update Utility
Tsctst.exe: Terminal Server Client License Dump Tool
Tsscalling.exe: Terminal Services Scalability Planning Tools
Uddicatschemeeditor.exe: UDDI Services Categorization Scheme Editor
Uddiconfig.exe: UDDI Services Command-line Configuration Utility
Uddidataexport.exe: UDDI Data Export Wizard
Usrmgr.exe: User Manager for Domains
Vadump.exe: Virtual Address Dump
Vfi.exe: Visual File Information
Volperf.exe: Shadow Copy Performance Counters
Volrest.exe: Shadow Copies for Shared Folders Restore Tool
Vrfydsk.exe: Verify Disk
Winexit.scr: Windows Exit Screen Saver
Winhttpcertcfg.exe: WinHTTP Certificate Configuration Tool
Winhttptracecfg.exe: WinHTTP Tracing Facility Configuration Tool
Winpolicies.exe: Policy Spy
Wins.dll: WINS Replication Network Monitor Parser
Wlbs_hb.dll & Wlbs_rc.dll: Windows Load Balancing Server Network Monitor Parsers
|
Комментарии
2010-04-2910:16:33 Спасибо за инфо. Полезная штука для разработки софта, а точнее оргии среды автоматического тестирования продукта. В котором идет активно печать, но результаты печати анализировать не надо. Печать в файл, в pdf, в doc, или в какойто левый принтер, который тупо накапливает очередь в спулере, не годится, так как со временем (автоматич тестирование идет каждую ночь) расходуются ресурсы памяти или диска тестовой среды.
2006-06-2114:11:33 Пардон, все работает. Copy/paste подвел - последнее слово NUL после параметра -r потерялось.
2006-06-2114:09:53 При выполнении последней строчки приведенного комадного кода у меня в консоли появляется следующее сообщение об ошибке: "Unable to parse command line, error 0x9. Subscript out of range"
Чтобы оно означало и что надо в строке исправить?
2006-06-2110:52:47 Цитирую andreo: а не проще установить принтер с портом FILE.
После запуска печати на такой принтер, у Вас появится диалог сохранения файла.. Сей эфект нежелателен, если прога периодически на принтер посылает одну строчку...
2006-06-2109:42:22 а не проще установить принтер с портом FILE и посылать печатать на него. ;)
2006-06-2015:42:48 Цитирую Прохожий: А нафига? Почти всегда есть "Microsoft Office Document Image Writer". А и правильнее он, чем Generic / Text only.
Ви работали с банками? У многих багков система еще в консоли работает и посылать данные надо именно на Generic / Text only.
2006-06-1913:44:16 Спасибо, попробую, но, обычно, для этих целей пользовался Adobe Acrobat. Так "честнее" хоть куд-то но "напечатает" :-)
2006-06-1911:07:15 А нафига? Почти всегда есть "Microsoft Office Document Image Writer". А и правильнее он, чем Generic / Text only.