stt = "HKEY_LOCAL_MACHINE" a = Shell("regedit /e
c:\windows\temp\temp.txt " & stt) '导出要修改的注册表分支 If a = 0 Then
MsgBox "导出错误!": End '可能是子键名称错误 regpath = "[" + stt + "]" Open
"c:\windows\temp\temp.txt" For Input As #1 Open
"c:\windows\temp\temp1.txt" For Output As #2 regwrite = flase
'是否是要修改的行 Print #2, "REGEDIT4" '写入文件头,注意必须是大写 Print #2,
"" Do Line Input #1, aa$ b$ = aa$ If regwrite = True
Then '说明此行是需要修改的行 b$ = "@=""默认值已修改!""" Print #2,
b$ MsgBox "原来的值为:" & Mid$(aa$, 3) & "即将改为:" &
Mid$(b$, 3), vbOKOnly, "注册表变化" End If If aa$ = regpath
Then Print #2, b$ regwrite = True
'说明下一行为所要修改的行,以便下次循环时对b$进行修改 Else regwrite = flase
'不是要修改的行 End If ' If Left(aa$, 2) <> "@=" And b$
= "@=""默认值已修改!""" Then Print #2,
aa$ '如果子键[HKEY_LOCAL_MACHINE\Software]中原来未设置默
认值,此时相当于在文件#1处插入b$。 Loop Until EOF(1) Close a = Shell("regedit
c:\windows\temp\temp1.txt ") '将修改后的内容导入到注册表中 If a = 0 Then
MsgBox "修改失败!":
End