Board logo

标题: 注册表中二进制读取问题(VBS) [打印本页]

作者: snowhill     时间: 2008-3-15 16:00    标题: 注册表中二进制读取问题(VBS)

'Date 2008-3-15 BY:snowhill
dim wshshell,result,enable,disable,warnning,answer
enable="Now,the usb is avaliable!"
disable="Now,the sub is disable!"
warning="Warning!"
key="HKLM\system\currentcontrolset\services\usbstor\Start"
set wshshell=wscript.createObject("wscript.shell")
result= wshshell.RegRead(key)
if( result=4) then
  answer=msgbox (disable&"are you want to enable the usb device?",1,Warnning)
   if (answer=1) then
    wshshell.Regwrite key,3,"REG_DWORD"
   end if
end if
if result="3" then
  answer=msgbox(enable&"are you want to disable the usb device?",1,warnning)
  if(answer=1)then
  wshshell.Regwrite key,4,"REG_DWORD"
  end if
end if
当读DWORD值是肯定没问题地,但读BINARY值就不行,哪位高手知道如何处理REG_BINARY问题啊.msgbox alltrim(str(result(1)))这是微软官网上的一个处理办法但行不通
作者: abcd     时间: 2008-3-15 16:12
vbs中,读取REG_BINARY的返回值是以数组形式的
作者: snowhill     时间: 2008-3-21 14:09
REG_BINARy返回值是以数组形式的,我怎么处理里面的值呢?能不能给一个实例.怎么改写里面的数据.
作者: abcd     时间: 2008-3-21 14:43
set ws=createobject("wscript.shell")
arr=ws.regread("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Security\Security")
for each ar in arr
   msgbox ar
next
作者: snowhill     时间: 2008-3-21 20:34
谢了,ABCD