用.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()是一个确认对话框.
本文来源:网络 作者:佚名