如何使用脚本更改 Internet Explorer 的主页






1.27/5 (4投票s)
展示如何使用脚本更改 Internet Explorer 的主页。
引言
本文解释了如何使用脚本更改 Internet Explorer 的主页。
使用代码
Internet Explorer 的起始页保存在注册表中。 如果您打开 Windows 注册表编辑器(转到“开始”->“运行”,键入 *regedit*)并导航到以下键位置,您将看到 IE 的当前起始页
My Computer->HKEY-CURRENT_USER->Software->Microsoft->InternetExplore->Main&-gt;Start Page
通过手动更改,您可以设置不同的主页。
以下代码展示了如何使用 VBScript 实现
定义两个对象来存储 Shell 对象。
Dim objShell, RegLocate
将 objShell
设置为新的 "WScript.Shell
" 对象。
Set objShell = WScript.CreateObject("WScript.Shell")
如果发生错误,则继续执行下一条指令
On Error Resume Next
这是 IE 主页的注册表路径
RegLocate = "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\StartPage"
objShell.RegWrite RegLocate,"http://www.earn100more.blogspot.com","REG_SZ"
显示完成消息并退出
WScript.Echo "Done"
WScript.Quit ' Quit the script
完整源代码
'Change home page of ie
'Author : Thilina Hasantha (thilina.hasantha@gmail.com)
Dim objShell, RegLocate
Set objShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next
'This is the registry path to home page of ie
RegLocate = "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\Start Page"
objShell.RegWrite RegLocate,"http://www.earn100more.blogspot.com","REG_SZ"
WScript.Echo "Done"
WScript.Quit ' Quit the script
关注点
操作 Windows 注册表时请小心。
历史
- 发布于 2007年8月31日。