天下网吧 >> 网吧天地 >> 网吧技术 >> 网吧软件 >> 正文

用脚本文件简单修改注册表

2006-8-11网络佚名

用.VBS脚本,也就是SCRIPT 脚本文件对注册表进行修改。如果您的爱机不支持VBSCRIPT,那么请您直接阅读第二部分。下面我通过一个例子自来解释脚本文件:

Windows Script Host Sample Script

You have a royalty-free right to use, modify, reproduce and distribute

the Sample Application Files (and/or any modified version) in any way

you find useful, provided that you agree that Microsoft has no warranty,

obligations or liability for any Sample Application Files.

------------------------------------------------------------------------

 

This sample demonstrates how to write/delete entries in the registry.

L_Welcome_MsgBox_Message_Text = "此脚本显示如何创建和删除注册表项。"

L_Welcome_MsgBox_Title_Text = "Windows Scripting Host 范例"

 

Call Welcome()

********************************************************************************

*

* Registry related methods.

*

 

Dim WSHShell

Set WSHShell = WScript.CreateObject("WScript.Shell")

 

WSHShell.Popup "创建项 HKCU\MyRegKey 数值为 Top level key"

WSHShell.RegWrite "HKCU\MyRegKey\", "Top level key"

 

WSHShell.Popup "创建项 HKCU\MyRegKey\Entry 数值为 Second level key"

WSHShell.RegWrite "HKCU\MyRegKey\Entry\", "Second level key"

 

WSHShell.Popup "将数值项 HKCU\MyRegKey\Value 设为 REG_SZ 1"

WSHShell.RegWrite "HKCU\MyRegKey\Value", 1

 

WSHShell.Popup "将数值项 HKCU\MyRegKey\Entry 设为 REG_DWORD 2"

WSHShell.RegWrite "HKCU\MyRegKey\Entry", 2, "REG_DWORD"

 

WSHShell.Popup "将数值项 HKCU\MyRegKey\Entry\Value1 设为 REG_BINARY 3"

WSHShell.RegWrite "HKCU\MyRegKey\Entry\Value1", 3, "REG_BINARY"

 

WSHShell.Popup ot;删除 HKCU\MyRegKey\Entry\Value1 数值"

WSHShell.RegDelete "HKCU\MyRegKey\Entry\Value1"

 

WSHShell.Popup "删除 HKCU\MyRegKey\Entry 项"

WSHShell.RegDelete "HKCU\MyRegKey\Entry\"

 

WSHShell.Popup "删除 HKCU\MyRegKey 项"

WSHShell.RegDelete "HKCU\MyRegKey\"

 

********************************************************************************

*

* Welcome

*

Sub Welcome()

Dim intDoIt

 

intDoIt = MsgBox(L_Welcome_MsgBox_Message_Text, _

vbOKCancel + vbInformation, _

L_Welcome_MsgBox_Title_Text )

If intDoIt = vbCancel Then

WScript.Quit

End If

End Sub

1.在上例中,单引号后面是注释.

2. L_Welcome_MsgBox_Message_Text = "此脚本显示如何创建和删除注册表项。"

L_Welcome_MsgBox_Title_Text = "Windows Scripting Host 范例"

这两句是提示.

3. 用 Set WSHShell = WScript.CreateObject("WScript.Shell"),定义一个对象WSHSHELL 为WScript.Shell,

 

4.WELCOME()是一个确认对话框.

本文来源:网络 作者:佚名

声明
声明:本站所发表的文章、评论及图片仅代表作者本人观点,与本站立场无关。文章是出于传递更多信息之目的。若有来源标注错误或侵犯了您的合法权益,请作者持权属证明与本网联系,我们将及时更正、删除,谢谢。 Email:support@txwb.com,系统开号,技术支持,服务联系微信:_WX_1_本站所有有注明来源为天下网吧或天下网吧论坛的原创作品,各位转载时请注明来源链接!
天下网吧·网吧天下
  • 本周热门
  • 本月热门
  • 阅读排行