您的位置:首页 > 理论基础 > 计算机网络

网络打印机安装脚本(rundll32 printui.dll,PrintUIEntry用法示例)

2007-12-18 22:54 141 查看
先将以下代码保存成为Add_Printer_Port.reg文件,用于创建网络打印机使用的标准TCP/IP端口:
 


Windows Registry Editor Version 5.00




[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlPrintMonitorsStandard TCP/IP PortPorts]


"StatusUpdateInterval"=dword:0000000a


"StatusUpdateEnabled"=dword:00000001




[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlPrintMonitorsStandard TCP/IP PortPortsIP_10.xx.xx.xx]


"Protocol"=dword:00000001


"Version"=dword:00000001


"HostName"=""


"IPAddress"="10.xx.xx.xx"


"HWAddress"=""


"PortNumber"=dword:0000238c


"SNMP Community"="public"


"SNMP Enabled"=dword:00000001


"SNMP Index"=dword:00000001 
然后使用rundll32 printui.dll,PrintUIEntry的方法可以为客户端安装网络打印机,驱动程序位于客户端可以访问的网络路径上,参考以下示例:
 


REM #*************************************************************************************


REM #


REM # Modified by Acer for YK Printer hp LaserJet 1300 PS in Dec 06 2005


REM # 使用此脚本需要本地安装驱动的权限


REM #


REM #*************************************************************************************




@echo off




cls


echo Please log on as administrator to run this script.


echo Press any key or use Ctrl+C to terminate the script and log on as administrator.


pause




echo.


echo Import Standard TCP/IP Port register info


regedit /s Add_Printer_Port.reg




echo.


echo After making changes to the registry, the Spooler service must be restarted for the new ports to be available.


net stop spooler & net start spooler




REM #*************************************************************************************


REM #


REM # /ia 用 inf 文件安装打印机驱动程序


REM # /if 用 inf 文件安装打印机


REM # /b[name] 基本打印机名


REM # /c[name] 如果操作在远程机器上,unc 机器名


REM # /dl 删除本地打印机


REM # /dn 删除网络打印机连接


REM # /dd 删除打印机驱动程序


REM # /f[file] inf 文件或输出文件


REM # /h[arch] 驱动程序体系结构,为下列之一: Alpha | Intel | IA64


REM # /m[model] 打印机驱动程序型号名


REM # /n[name] 打印机名


REM # /v[version] 驱动程序版本属于下列中的一个: Windows 95、98 和 ME | Windows NT 4.0 | Windows NT 4.0 或 2000 | Windows 2000 或 XP|  Windows XP 


REM # /q 安静模式,不显示错误信息


REM # /r[port] 端口名


REM # /y 将打印机设为默认打印机


REM # /z 不要自动共享这台打印机


REM # /Z 共享这台打印机,只能跟 /if 选项一起使用


REM #


REM #


REM # 更多的帮助请使用rundll32 printui.dll,PrintUIEntry /?


REM #


REM #*************************************************************************************




echo Remove existing Printer with the same Name to avoid getting copy after copy


rundll32 printui.dll,PrintUIEntry /dl /n "hp LaserJet 1300 PS" /q




echo .


echo Installing hp LaserJet 1300 PS Printer......


rundll32 printui.dll,PrintUIEntry /if /b "hp LaserJet 1300 PS" /f "/MyServerPrint Drivershp1300Nlj1300pswin2kxp-schp1300mp.inf" /r "IP_10.xx.xx.xx" /m "hp LaserJet 1300 PS" /z

Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1135888
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐