Board logo

标题: vbs修改注册表~ [打印本页]

作者: yhshiro     时间: 2008-4-12 14:27    标题: vbs修改注册表~

如果我想让注册表的某个键值等于VBS里面的一个变量 要怎么搞??

如:

Name=前缀+IP

然后再把Name 这个数值添入注册表某个键值


[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet003\Control\ComputerName\ActiveComputerName]
"ComputerName"="填在这里"

该如何写?
作者: abcd     时间: 2008-4-12 14:48
CODE:  [Copy to clipboard]
set ws=createobject("wscript.shell")
ws.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet003\Control\ComputerName\ActiveComputerName\ComputerName",Name,"REG_SZ"

msgbox ws.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet003\Control\ComputerName\ActiveComputerName\ComputerName")

作者: yhshiro     时间: 2008-4-12 17:01
不行...
改不了,只会变成空的数值.
作者: abcd     时间: 2008-4-12 17:23
楼主是怎么执行那段的??
作者: chishingchan     时间: 2008-4-12 17:26
2楼的代码只有键值,没设置数值,肯定是空的了。
作者: yhshiro     时间: 2008-4-12 17:28
set ws=createobject("wscript.shell")
Dim Name
Name=BC5
ws.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet003\Control\ComputerName\ActiveComputerName\ComputerName",Name,"REG_SZ"

msgbox ws.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet003\Control\ComputerName\ActiveComputerName\ComputerName")
作者: abcd     时间: 2008-4-12 17:29
Name="BC5"
作者: yhshiro     时间: 2008-4-12 17:29
给个例子吧...我不懂这些
作者: yhshiro     时间: 2008-4-12 17:31
哈哈,有了

谢谢了




欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) Powered by Discuz! 2.5