标题: [注册表类] [已解决]批处理设置打印端口时,注册表项的值如何搞定? [打印本页]
作者: perfectxy 时间: 2013-12-12 14:43 标题: [已解决]批处理设置打印端口时,注册表项的值如何搞定?
本帖最后由 perfectxy 于 2014-1-13 14:50 编辑
本人制作一个脚本,为机房电脑配置网络打印机,在设置打印端口时,注册表项的值无法搞定,请大虾帮助。部分代码如下:
::::创建注册表文件(PrntPort.reg)设置打印机端口
::::用变量"%PrntIP%"去设置打印机端口
@echo Windows Registry Editor Version 5.00 >PrntPort.reg
@echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports] >>PrntPort.reg
@echo "StatusUpdateInterval"=dword:0000000a >>PrntPort.reg
@echo "StatusUpdateEnabled"=dword:00000001 >>PrntPort.reg
@echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\"%PrintIP%"] >>PrntPort.reg
@echo "Protocol"=dword:00000001 >>PrntPort.reg
@echo "Version"=dword:00000001 >>PrntPort.reg
@echo "HostName"="%PrintIP%" >>PrntPort.reg
@echo "IPAddress"="%PrintIP%" >>PrntPort.reg
@echo "HWAddress"="" >>PrntPort.reg
@echo "PortNumber"=dword:0000238c >>PrntPort.reg
@echo "SNMP Community"="public" >>PrntPort.reg
@echo "SNMP Enabled"=dword:00000000 >>PrntPort.reg
@echo "SNMP Index"=dword:00000001 >>PrntPort.reg
其中由于有多台网络打印机,IP地址设定为192.168.1.11、192.168.1.12、192.168.1.13.....因此希望端口名称为打印机的IP地址,红色部分有问题,但是不知如何修改。
作者: Batcher 时间: 2013-12-12 18:50
- @echo off
- >PrntPort.reg echo Windows Registry Editor Version 5.00
- >>PrntPort.reg echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports]
- >>PrntPort.reg echo "StatusUpdateInterval"=dword:0000000a
- >>PrntPort.reg echo "StatusUpdateEnabled"=dword:00000001
- (for /f %%i in (ip.txt) do (
- echo,
- echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\"%%i"]
- echo "Protocol"=dword:00000001
- echo "Version"=dword:00000001
- echo "HostName"="%%i"
- echo "IPAddress"="%%i"
- echo "HWAddress"=""
- echo "PortNumber"=dword:0000238c
- echo "SNMP Community"="public"
- echo "SNMP Enabled"=dword:00000000
- echo "SNMP Index"=dword:00000001
- echo,
- ))>>PrntPort.reg
复制代码
作者: perfectxy 时间: 2013-12-12 20:44
感谢楼上,我试一下
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |