标题: [文本处理] 怎么把注册表写到批处理里? [打印本页]
作者: xiang1771 时间: 2018-9-20 09:17 标题: 怎么把注册表写到批处理里?
注册表里,直接加reg add吗?不是很明白……。
我想把下面两个脚本合并成一个。- @echo off
- color 0A
- echo.
- echo.
- echo.
- rem 自动判断电脑是32位还是64位
- if /i "%PROCESSOR_IDENTIFIER:~0,3%"=="X86" (goto 32bit) ELSE (goto 64bit)
-
- :64bit
- echo 正在为您安装64位打印机驱动
- echo.
- rem 导入添加端口的注册表文件
- reg import 17wysh.reg ####应该是把注册表加到这吧?但我不知道用什么命令~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- if errorlevel 0 echo 网络打印机端口安装成功
- echo.
- echo 正在重启打印服务,请稍等……
- echo.
- rem 必须重启打印服务才能成功添加端口
- net stop spooler>nul
- net start spooler>nul
- if errorlevel 0 echo 打印服务重启成功
- echo ..............................................
- echo ..............................................
- echo 删除已经存在的同名打印机
- rundll32 printui.dll,PrintUIEntry /dl /n "HP LaserJet MFP M725 PCL 6" /q
- echo.
- echo 安装HP LaserJet MFP M725 PCL 6打印机......
- echo.
- rundll32 printui.dll,PrintUIEntry /if /b "HP LaserJet MFP M725 PCL 6(17层文印室)" /f \\11.150.191.219\02常用驱动\1HP打印驱动\laserjet_m725\x64\hpcm725u.inf /r "IP_11.150.169.117" /m "HP LaserJet MFP M725 PCL 6" /z
- if errorlevel 0 echo 打印机安装成功
- echo.
- rem 安装好打印机后,也可以在批处理文件最后加一行命令,把这个打印机设置为默认。
- echo.
- echo 将这个打印机设置为默认打印机
- rundll32 printui.dll,PrintUIEntry /y /n "HP LaserJet MFP M725 PCL 6(17层文印室)"
- goto end
-
- :32bit
- echo 正在为您安装32位打印机驱动
- echo.
- reg import 17wysh.reg ####应该是把注册表加到这吧?但我不知道用什么命令~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- if errorlevel 0 echo 网络打印机端口安装成功
- echo.
- echo 正在重启打印服务,请稍等……
- echo.
- net stop spooler>nul
- net start spooler>nul
- if errorlevel 0 echo 打印服务重启成功
- echo ..............................................
- echo ..............................................
- echo 删除已经存在的同名打印机
- rundll32 printui.dll,PrintUIEntry /dl /n "HP LaserJet MFP M725 PCL 6" /q
- echo.
- echo 安装HP LaserJet MFP M725 PCL 6......
- echo.
- rundll32 printui.dll,PrintUIEntry /if /b "HP LaserJet MFP M725 PCL 6(17层文印室)" /f \\11.150.191.219\02常用驱动\1HP打印驱动\laserjet_m725\x86\hpcm725c.inf /r "IP_11.150.169.117" /m "HP LaserJet MFP M725 PCL 6" /z
- if errorlevel 0 echo 打印机安装成功
- echo.
- echo.
- echo 将这个打印机设置为默认打印机
- rundll32 printui.dll,PrintUIEntry /y /n "HP LaserJet MFP M725 PCL 6(17层文印室)"
-
- :end
- echo 请按任意键退出
- pause>nul
复制代码
如何把这个注册表转换成BAT……- 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_11.150.169.117]
- "Protocol"=dword:00000002
- "Version"=dword:00000002
- "HostName"="11.150.169.117"
- "IPAddress"=""
- "HWAddress"=""
- "PortNumber"=dword:00000203
- "SNMP Community"="public"
- "SNMP Enabled"=dword:00000001
- "SNMP Index"=dword:00000001
- "PortMonMibPortIndex"=dword:00000001
- "Queue"="print"
- "Double Spool"=dword:00000000
-
-
- [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports]
- "StatusUpdateInterval"=dword:0000000a
- "StatusUpdateEnabled"=dword:00000001
- [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117]
- "Protocol"=dword:00000002
- "Version"=dword:00000002
- "HostName"="11.150.169.117"
- "IPAddress"=""
- "HWAddress"=""
- "PortNumber"=dword:00000203
- "SNMP Community"="public"
- "SNMP Enabled"=dword:00000001
- "SNMP Index"=dword:00000001
- "PortMonMibPortIndex"=dword:00000001
- "Queue"="print"
- "Double Spool"=dword:00000000
复制代码
作者: 窄口牛 时间: 2018-9-20 09:39
[code@echo off
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports" /v "StatusUpdateInterval" /t REG_DWORD /d 10 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports" /v "StatusUpdateEnabled" /t REG_DWORD /d 1 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "Protocol" /t REG_DWORD /d 2 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "Version" /t REG_DWORD /d 2 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "HostName" /d "11.150.169.117" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "IPAddress" /d "" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "HWAddress" /d "" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "PortNumber" /t REG_DWORD /d 515 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "SNMP Community" /d "public" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "SNMP Enabled" /t REG_DWORD /d 1 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "SNMP Index" /t REG_DWORD /d 1 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "PortMonMibPortIndex" /t REG_DWORD /d 1 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "Queue" /d "print" /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "Double Spool" /t REG_DWORD /d 0 /f
reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports" /v "StatusUpdateInterval" /t REG_DWORD /d 10 /f
reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports" /v "StatusUpdateEnabled" /t REG_DWORD /d 1 /f
reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "Protocol" /t REG_DWORD /d 2 /f
reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "Version" /t REG_DWORD /d 2 /f
reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "HostName" /d "11.150.169.117" /f
reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "IPAddress" /d "" /f
reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "HWAddress" /d "" /f
reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "PortNumber" /t REG_DWORD /d 515 /f
reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "SNMP Community" /d "public" /f
reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "SNMP Enabled" /t REG_DWORD /d 1 /f
reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "SNMP Index" /t REG_DWORD /d 1 /f
reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "PortMonMibPortIndex" /t REG_DWORD /d 1 /f
reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "Queue" /d "print" /f
reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_11.150.169.117" /v "Double Spool" /t REG_DWORD /d 0 /f
][/code]
作者: Batcher 时间: 2018-9-20 11:06
看看 reg add 命令教程和例子,很简单的:
http://bbs.bathome.net/thread-3747-1-1.html
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |