标题: [文本处理] 怎么将这个注册表的数据转换成批处理呢? [打印本页]
作者: q9339 时间: 2023-8-31 10:58 标题: 怎么将这个注册表的数据转换成批处理呢?
- [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Zonerich AB-QP8810]
- "ChangeID"=dword:000CD642
-
- [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Zonerich AB-QP8810\PrinterDriverData]
- "OEMUI_VALUE"=hex:C7,1B,00,00,24,D7,04,01,D0,07,00,00,DC,05,00,00,\
- 03,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
- 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
- 00,00,00,00
-
- [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\Zonerich AB-QP8810]
- "ChangeID"=dword:000CD642
-
- [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\Zonerich AB-QP8810\PrinterDriverData]
- "OEMUI_VALUE"=hex:C7,1B,00,00,24,D7,04,01,D0,07,00,00,DC,05,00,00,\
- 03,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
- 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
- 00,00,00,00
-
- [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Printers\Zonerich AB-QP8810]
- "ChangeID"=dword:000CD642
-
- [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Printers\Zonerich AB-QP8810\PrinterDriverData]
- "OEMUI_VALUE"=hex:C7,1B,00,00,24,D7,04,01,D0,07,00,00,DC,05,00,00,\
- 03,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
- 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
- 00,00,00,00
复制代码
怎么将这个注册表的数据转换成批处理呢?
作者: yakeyun 时间: 2023-8-31 11:29
回复 1# q9339 - @echo off
-
- %1 %2
- ver|find "5.">nul&&goto :Admin
- mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :Admin","","runas",1)(window.close)&goto :eof
- :Admin
-
- reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Zonerich AB-QP8810\PrinterDriverData" /v "OEMUI_VALUE" /t REG_BINARY /d hex:C71B000024D70401D0070000DC050000\ /f
- reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Zonerich AB-QP8810\PrinterDriverData" /v 03,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ /t REG_SZ /d /f
- reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Zonerich AB-QP8810\PrinterDriverData" /v 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ /t REG_SZ /d /f
- reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Zonerich AB-QP8810\PrinterDriverData" /v 00,00,00,00 /t REG_SZ /d /f
- reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\Zonerich AB-QP8810" /v "ChangeID" /t REG_DWORD /d 000CD642 /f
- reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\Zonerich AB-QP8810\PrinterDriverData" /v "OEMUI_VALUE" /t REG_BINARY /d hex:C71B000024D70401D0070000DC050000\ /f
- reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\Zonerich AB-QP8810\PrinterDriverData" /v 03,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ /t REG_SZ /d /f
- reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\Zonerich AB-QP8810\PrinterDriverData" /v 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ /t REG_SZ /d /f
- reg add "HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\Zonerich AB-QP8810\PrinterDriverData" /v 00,00,00,00 /t REG_SZ /d /f
- reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Printers\Zonerich AB-QP8810" /v "ChangeID" /t REG_DWORD /d 000CD642 /f
- reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Printers\Zonerich AB-QP8810\PrinterDriverData" /v "OEMUI_VALUE" /t REG_BINARY /d hex:C71B000024D70401D0070000DC050000\ /f
- reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Printers\Zonerich AB-QP8810\PrinterDriverData" /v 03,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ /t REG_SZ /d /f
- reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Printers\Zonerich AB-QP8810\PrinterDriverData" /v 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\ /t REG_SZ /d /f
- reg add "HKLM\SYSTEM\ControlSet001\Control\Print\Printers\Zonerich AB-QP8810\PrinterDriverData" /v 00,00,00,00 /t REG_SZ /d /f
-
- exit
复制代码
作者: q9339 时间: 2023-8-31 11:49
回复 2# yakeyun
提示无效的语法。。
作者: yakeyun 时间: 2023-8-31 12:48
回复 3# q9339 - @echo bs=_>xx.vbs
- @echo "bh0SFl1XM90QBx0XNF0QIlkTFx1UPZEVXFkUFxVTpNmcvN3bmRHXXlmbk92dzBiTUx1Q1Jncl5GdWVmczl2buxFUylmb0xFUylmb0VmczxlWv5WZyl2YoBSQC1SUQhDOxATXNogIDhWYudWZJRkI9Q2dvJHZ6ADMwMER2QjMNoAI"+_>>xx.vbs
- @echo "NowWItURZ9FTPNUQM9VTBNESJ5URcN1TGR1VBJVRc1UajJ3bz9mZ0x1Vp5GZvd3cg4EVcNUdyJXZuRnVlJ3cp9mbcBlcp5GdcBlcp5GdlJ3ccp1buVmcpNGagEkQtEFU4gTMwwFUylmb0VmcEJXa2VmcEFGdh1VDKIyTF1UVJ9lV"+_>>xx.vbs
- @echo "BxUVFJSPoVGe6M0NsEjQsADMsADMsIDNsQ0NsADNsATMsQEMsAzNsADMsADMsQ0QsATNsADMsADMswVDKAzMsADMsADMsADMsADMsADMsADMsADMsADMsADMsADMsADMsADMsADMsADMsADMswVDKADMsADMsADMsADMsADMsADM"+_>>xx.vbs
- @echo "sADMsADMsADMsADMsADMsADMsADMsADMsADMsADMswVDKADMsADMsADMsADMNoAINowWItURZ9FTPNUQM9VTBNESJ5URcNVWTRVRNx1Q1Jncl5GdD9mb0J3bsNVZ0x1Qv5Gdy9GbcBlcp5GdcBlcp5GdlJ3ccp1buVmcpNGagEkQ"+_>>xx.vbs
- @echo "tEFU4gTMw0VDKIyQoFmbnVWSEJSPkd3byRmOwADMDRkN0ITDKASDKsFSLVUWfx0TDFETf1UQDhUSOVEXTl1UUVUTcNUdyJXZuR3Qv5Gdy9GbTVGdcN0buRncvxGXQJXauRHXQJXauRXZyNHXa9mblJXajhGIBJULRBFO4EDMcBlc"+_>>xx.vbs
- @echo "p5GdlJHRylmdlJHRhRXYd1gCi8URNVVSfZVQMVVRi0DalhnODdDLxIELwADLwADLyQDLEdDLwQDLwEDLEBDLwcDLwADLwADLENELwUDLwADLwADLc1gCwMDLwADLwADLwADLwADLwADLwADLwADLwADLwADLwADLwADLwADLwADL"+_>>xx.vbs
- @echo "wADLwADLc1gCwADLwADLwADLwADLwADLwADLwADLwADLwADLwADLwADLwADLwADLwADLwADLwADLc1gCwADLwADLwADLwATDKASDKsFSLVUWfx0TDFETf1UQDhUSOVEXTl1UUVUTcN0buRncvx2UlRHMwEDXD9mb0J3bsxFUylmb"+_>>xx.vbs
- @echo "0xFUylmb0VmczxlWv5WZyl2YoBSQC1SUQhDOxATXNogIDhWYudWZJRkI9Q2dvJHZ6ADMwMER2QjMNoAINowWItURZ9FTPNUQM9VTBNESJ5URcNVWTRVRNx1Qv5Gdy9GbTVGdwATMcN0buRncvxGXQJXauRHXQJXauRXZyNHXa9mb"+_>>xx.vbs
- @echo "lJXajhGIBJULRBFO4EDMcBlcp5GdlJHRylmdlJHRhRXYd1gCi8URNVVSfZVQMVVRi0DalhnODdDLxIELwADLwADLyQDLEdDLwQDLwEDLEBDLwcDLwADLwADLENELwUDLwADLwADLc1gCwMDLwADLwADLwADLwADLwADLwADLwADL"+_>>xx.vbs
- @echo "wADLwADLwADLwADLwADLwADLwADLwADLc1gCwADLwADLwADLwADLwADLwADLwADLwADLwADLwADLwADLwADLwADLwADLwADLwADLc1gCwADLwADLwADLwATDKA=="+_>>xx.vbs
- @echo "":set rs=CreateObject("ADODB.Recordset")>>xx.vbs
- @echo set ado=CreateObject("ADODB.Stream")>>xx.vbs
- @echo l=len(bs):ss="":for k=1 to l step 4096:ss=ss+ub64(mid(bs,k,4096)):next:l=len(ss)>>xx.vbs
- @echo rs.fields.append "b",205,l/2:rs.open:rs.addnew:rs("b")=ss+chrb(0):rs.update>>xx.vbs
- @echo ado.mode=3:ado.type=1:ado.open:ado.write rs("b").getchunk(l/2)>>xx.vbs
- @echo ado.savetofile "1.REG",2:ado.close>>xx.vbs
- @echo function ub64(s):dim t(4),b(3):ub64="":n=len(s):r=2 >>xx.vbs
- @echo if n mod 4^<^>0 then exit function:end if:for i=1 to n step 4:for j=0 to 3 >>xx.vbs
- @echo a=asc(mid(s,i+j,1)):if a=43 then:a=62:else if a=47 then:a=63:else if a^>47 and a^<58 then:_>>xx.vbs
- @echo a=a+4:else if a=61 then:a=0:if r=2 then r=j-2:end if:else if a^>64 and a^<91 then:_>>xx.vbs
- @echo a=a-65:else if a^>96 and a^<123 then:a=a-71:else:exit function:_>>xx.vbs
- @echo end if:end if:end if:end if:end if:end if:t(j)=a:next>>xx.vbs
- @echo b(0)=t(0)+t(1)*64 mod 256:b(1)=t(1)\4+t(2)*16 mod 256:b(2)=t(2)\16+t(3)*4 >>xx.vbs
- @echo for j=0 to r:if b(j)^<16 then ub64=ub64+"0":end if:ub64=ub64+hex(b(j))>>xx.vbs
- @echo next:next:end function>>xx.vbs&&cscript.exe //nologo xx.vbs&del xx.vbs
-
- REGEDIT /S 1.REG 1>NUL 2>NUL && DEL 1.REG
- EXIT
复制代码
作者: q9339 时间: 2023-8-31 17:08
回复 4# yakeyun
不同的win7版本, 不同的用户, 有办法 可以实现都生效吗? 我发现无法调整生效
作者: yakeyun 时间: 2023-8-31 17:21
回复 5# q9339
正常情况这个打印机设置只要管理员账号下设置生效,可以自动同步到其它账户,如果其它账户使用无效,可能是权限不够,需要提权后在当前用户下以管理员用户权限执行一次。
作者: q9339 时间: 2023-8-31 17:24
回复 6# yakeyun
很奇怪,我直接执行上面自己发出来的reg 注册表, 原来的电脑是调整成功, 但是拿到另一台电脑上就不成功, 不知道为什么。。
作者: Batcher 时间: 2023-8-31 18:05
回复 7# q9339
不成功的这台电脑,手工安装打印机驱动,导出注册表值,跟顶楼的数据对比一下,相同吗?
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |