批处理自动安装打印机

 

 

@echo   off
title 广州网络打印机自动安装程序         Powered By XXX     Telphone: XXX

mode  con cols = 100  lines = 20
color F0
Echo  正在帮你设置打印机,请稍候……
net   use   \\ 192.168 . 70.12   / delete
net   use   \\ 192.168 . 70.12   / user :user  user 

if   exist   " %windir%/System32/en-US/user32.dll.mui "   ( goto   12 )   else   ( goto   11 )

:
11
regedit 
/ s PrintXp . reg   
net  stop spooler
net   start  spooler
rundll32 printui
. dll , PrintUIEntry  / if   / " FX DocuCentre 659 CP "   / " IP_192.168.70.20 "   / " FX DocuCentre 659 CP "   / / " \\192.168.70.12\software\驱动程序\659\FXLOCJI.inf "   / q
rundll32 printui
. dll , PrintUIEntry  / / " FX DocuCentre 659 CP "   / q
goto   13

:
12
regedit 
/ s PrintVista . reg
net  stop spooler
net   start  spooler
rundll32 printui
. dll , PrintUIEntry  / if   / " FX DocuCentre 659 CP "   / " 192.168.70.20 "   / " FX DocuCentre 659 CP "   / / " \\192.168.70.12\software\驱动程序\fujiPrinter\FXLOCJI.inf "
rundll32 printui
. dll , PrintUIEntry  / / " FX DocuCentre 659 CP "  
goto   13

:
13
echo .
echo  打印机安装完成,请测试是否安装成功!
echo .
echo  如有问题,请手动连接打印机,具体操作请查看邮件中打印说明文档,谢谢!
echo .
pause
echo .
exit

 

 上次忘了提供Printvista.reg和PrintXP.reg的文件,现在补上:
  Printvista.reg ,将下面的文件复制并保存为reg文件。
Windows Registry Editor Version  5.00

[ HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports ]
" StatusUpdateInterval " = dword:0000000a
" StatusUpdateEnabled " = dword: 00000001
" LprAckTimeout " = dword:000000b4

[ HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\192.168.70.40 ]
" Protocol " = dword: 00000001
" Version " = dword: 00000002
" HostName " = " 192.168.70.40 "
" IPAddress " = ""
" HWAddress " = ""
" PortNumber " = dword:0000238c
" SNMP Community " = " public "
" SNMP Enabled " = dword: 00000000
" SNMP Index " = dword: 00000001
" PortMonMibPortIndex " = dword: 00000000

 PrintXP.reg 保存为REG文件

 

Windows Registry Editor Version  5.00

[ HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports ]
" StatusUpdateInterval " = dword:0000000a
" StatusUpdateEnabled " = dword: 00000001

[ HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_192.168.70.40 ]
" Protocol " = dword: 00000001
" Version " = dword: 00000001
" HostName " = ""
" IPAddress " = " 192.168.70.40 "
" HWAddress " = ""
" PortNumber " = dword:0000238c
" SNMP Community " = " public "
" SNMP Enabled " = dword: 00000000
" SNMP Index " = dword: 00000000

 
另外,在DOS里面有个命令reg add,也是增加注册表文件,大家可以在命令行模式下输入reg /?来获取更多的信息。

你可能感兴趣的:(批处理)