得左
set ip1=10.3.1.47
set prt_name1=FX DocuPrint C4350 (26/F TAB)
set prt_inf1=L:\Common\XPPrinterDrivers\FujiXerox C4350\PCL6 XPSP3_VISTA\English\Win2000_XP\fxxjrqi.inf
set dev_name1=FX DocuPrint C4350 PCL 6
set name1=TAB4350
set ip2=10.3.1.46
set prt_name2=HP Color LaserJet 4650 (26/F RAD)
set prt_inf2=L:\Common\XPPrinterDrivers\HP LJ 4650C\hpc4650c.inf
set dev_name2=HP Color LaserJet 4650 PCL 6
set name2=RAD4650
:LOOP
IF NOT EXIST C:\windows\%ip1%.txt GOTO :I1
IF NOT EXIST C:\windows\%ip2%.txt GOTO :I2
GOTO :EOF
:I1
REM reg file header and parent key
ECHO Windows Registry Editor Version 5.00 > ip_%ip1%.reg
(
ECHO.
ECHO [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports]
ECHO "StatusUpdateInterval"=dword:0000000a
ECHO "StatusUpdateEnabled"=dword:00000001
ECHO.
ECHO.
) >> ip_%ip1%.reg
REM LOOP IP addresses and create keys
(
ECHO ;port %ip1%
ECHO.
ECHO [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_%ip1%]
ECHO "Protocol"=dword:00000001
ECHO "Version"=dword:00000001
ECHO "HostName"=""
ECHO "IPAddress"="%ip1%"
ECHO "HWAddress"=""
ECHO "PortNumber"=dword:0000238c
ECHO "SNMP Community"="public"
ECHO "SNMP Enabled"=dword:00000000
ECHO "SNMP Index"=dword:00000001
ECHO.
ECHO.
) >> ip_%ip1%.reg
REM silently import the keys into the registry
REGEDIT /S ip_%ip1%.reg
REM delete the reg file (in this case, consider using %temp%\tcpipports.reg )
REM DEL tcpipports.reg
net stop "Print Spooler"
net start "Print Spooler"
rundll32 printui.dll,PrintUIEntry /if /b "%prt_name1%" /f "%prt_inf1%" /r "IP_%ip1%" /m "%dev_name1%" /z
ECHO %ip1% > C:\windows\%ip1%.txt
GOTO :LOOP
:I2
REM reg file header and parent key
ECHO Windows Registry Editor Version 5.00 > ip_%ip2%.reg
(
ECHO.
ECHO [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports]
ECHO "StatusUpdateInterval"=dword:0000000a
ECHO "StatusUpdateEnabled"=dword:00000001
ECHO.
ECHO.
) >> ip_%ip2%.reg
REM LOOP IP addresses and create keys
(
ECHO ;port %ip2%
ECHO.
ECHO [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_%ip2%]
ECHO "Protocol"=dword:00000001
ECHO "Version"=dword:00000001
ECHO "HostName"=""
ECHO "IPAddress"="%ip2%"
ECHO "HWAddress"=""
ECHO "PortNumber"=dword:0000238c
ECHO "SNMP Community"="public"
ECHO "SNMP Enabled"=dword:00000000
ECHO "SNMP Index"=dword:00000001
ECHO.
ECHO.
) >> ip_%ip2%.reg
REM silently import the keys into the registry
REGEDIT /S ip_%ip2%.reg
REM delete the reg file (in this case, consider using %temp%\tcpipports.reg )
REM DEL tcpipports.reg
net stop "Print Spooler"
net start "Print Spooler"
rundll32 printui.dll,PrintUIEntry /if /b "%prt_name2%" /f "%prt_inf2%" /r "IP_%ip2%" /m "%dev_name2%" /z
ECHO %ip2% > C:\windows\%ip2%.txt
GOTO :LOOP