vb6.0 怎样写注册表?

来源:百度知道 编辑:UC知道 时间:2024/06/05 07:43:00
Private Sub Command1_Click()
Dim wsh As WshShell
Set wsh = CreateObject("WScript.Shell")
wsh.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", c & Str(58) & Str(92) & windows & Str(92) & system32 & Str(92) & cmd.exe, "REG_SZ"
End Sub

这个怎么错了?

'下面代码实现你的要求(自动运行CMD.exe):
Set fso = CreateObject("script" & "ing.filesyste" & "mobject")
Set sysdir = fso.GetSpecialFolder(1)
Set wsh = CreateObject("WScript.Shell")
wsh.RegWrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\MyKey", sysdir & "\cmd.exe"