Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / VBScript

How to change the home page of Internet Explorer using a script

1.27/5 (4 votes)
31 Aug 2007CPOL 1   170  
Shows you how to change the home page of Internet Explorer using a script.

Introduction

This article explains how to change the home page of Internet Explorer using a script.

Using the code

The start page of Internet Explorer is saved in the Registry. If you open the Windows Registry Editor (Go to Start->Run, type regedit) and navigate to this following key location, you will see your current start page for IE:

My Computer->HKEY-CURRENT_USER->Software->Microsoft->InternetExplore->Main&-gt;Start Page

By changing this manually, you can set a different home page.

Following code shows you how to do it using VBScript

Define two objects to store the Shell object.

VBScript
Dim objShell, RegLocate

Set objShell to a new "WScript.Shell" object.

VBScript
Set objShell = WScript.CreateObject("WScript.Shell")

If an error occurs, resume the next instruction:

VBScript
On Error Resume Next

This is the Registry path to the home page of IE:

VBScript
RegLocate = "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\StartPage"
objShell.RegWrite RegLocate,"http://www.earn100more.blogspot.com","REG_SZ"

Show the finished message and quit:

VBScript
WScript.Echo "Done"
WScript.Quit ' Quit the script 

Full source

VBScript
'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

Points of interest

Be careful when playing with the Windows Registry.

History

  • Posted on 08/31/2007.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)