中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-07-03 17:49
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 注册表中二进制读取问题(VBS) 查看 811 回复 4
楼 主 注册表中二进制读取问题(VBS) 发表于 2008-03-15 16:00 ·  中国 重庆 南岸区 电信
新手上路
积分 11
发帖 6
注册 2008-02-18 17:38
18年会员
UID 110910
性别 男
状态 离线
'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)))这是微软官网上的一个处理办法但行不通
2 发表于 2008-03-15 16:12 ·  中国 北京 华为云
银牌会员
★★★
积分 1,436
发帖 739
注册 2007-10-11 17:44
18年会员
UID 99469
性别 男
状态 离线
vbs中,读取REG_BINARY的返回值是以数组形式的
3 发表于 2008-03-21 14:09 ·  中国 重庆 南岸区 电信
新手上路
积分 11
发帖 6
注册 2008-02-18 17:38
18年会员
UID 110910
性别 男
状态 离线
REG_BINARy返回值是以数组形式的,我怎么处理里面的值呢?能不能给一个实例.怎么改写里面的数据.
4 发表于 2008-03-21 14:43 ·  中国 北京 华为云
银牌会员
★★★
积分 1,436
发帖 739
注册 2007-10-11 17:44
18年会员
UID 99469
性别 男
状态 离线
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
5 发表于 2008-03-21 20:34 ·  中国 重庆 南岸区 电信
新手上路
积分 11
发帖 6
注册 2008-02-18 17:38
18年会员
UID 110910
性别 男
状态 离线
谢了,ABCD
论坛跳转: