示例代码(写入操作):
Private Sub cmdReg_Click() '利用WshShell Object写入
Dim a
Set a = CreateObject("wscript.shell")
'The RegWrite method sets the registry key or value named by strName.
'Syntax
'WshShell.RegWrite strName, anyValue, [strType]
a.RegWrite "HKEY_LOCAL_MACHINE\SoftWare\Microsoft\Windows\CurrentVersion\Run\" & App.EXEName, _
App.Path & "\" & App.EXEName & ".exe"End Sub
另外,删除、读取操作如下:
WshShell.RegDelete
The RegDelete method deletes from the registry the key or value named strName.
Syntax
WshShell.RegDelete strName
Parameters
strName
If strName ends with a backslash character (\), this method deletes the key instead of the value.
The strName parameter must begin with one of following root key names: Short Long
HKCU HKEY_CURRENT_USER
HKLM HKEY_LOCAL_MACHINE
HKCR HKEY_CLASSES_ROOT
HKEY_USERS
HKEY_CURRENT_CONFIG
WshShell.RegRead
The RegRead method returns the registry key or value named by strName.
Syntax
WshShell.RegRead(strName) = strValue
已经有(0)位网友发表了评论,你也评一评吧!
原创文章如转载,请注明:转载自Eddy Blog
原文地址:http://www.rrgod.com/program/464.html 欢迎订阅Eddy Blog。
Tags:VB WshShell Objec t操作 注册表