Subscribe

Get the Network Administrators tool pack

Subscribe to our newsletter and get 11 free network administrator tools, plus a 30 page user guide so you can get the most out of them.

Click Here to get your free tools

Recent Posts

Search

Archives

Set IE default home page from a script

by Steve Wiseman on August 8, 2007 · 9 comments

in Windows


.

Once and a while we visit local customers. It is a great way to see our software working in the real world, and find out what we can do to make our products better. Many times I will be asked to solve an issue (That has nothing to do with our software)

This week while visiting a customer I was asked if there was a simple way to create a batch file (No VB Script) that would reset the default home page of IE 6. For various reasons they could not use Active Directory, nor could they use VB Script.

I started to play around with the command line options of regedit, and discovered it was not going to work. After some research I came across the reg.exe command. It seems like it is built into XP, 2003, and Vista. It is perfect for what I needed.

It allows you to modify/delete keys from the command line. Here is what I came up with:

Update IE Home Page

I saved it as UpdateIE.bat. Now I can simply call it like this:

UpdateIE “http://www.intelliadmin.com”

It updates the local users IE home page, and very easy to add to a login script

(Below is the script source so you can copy and paste it)

@echo off
set key=HKCU\Software\Microsoft\Internet Explorer\Main
set value=Start page
set data=%1
reg.exe add “%key%” /v “%value%” /d “%data%” /f

One more thing…Subscribe to my newsletter and get 11 free network administrator tools, plus a 30 page user guide so you can get the most out of them. Click Here to get your free tools

Related Articles:

{ 9 comments… read them below or add one }

1 Craig June 2, 2010 at 11:06 pm

What adjustments to this script (which works great for IE8 on Win7) are required to run under Citrix?

2 Chris September 28, 2010 at 8:33 pm

Thanks for the assist.

But your example is a little off and it took me a little while to debug. First, path you showed has spaces (‘Internet Explorer’) So the path should be enclosed in double quotes. Also, the parameters are not delimited correctly. Need to remove the quotes from there. Here is what I got to work:

@echo off
set key=”HKCU\Software\Microsoft\Internet Explorer\Main”
set value=”Start page”
set data=%1
reg.exe add %key% /v %value% /d %data% /f

3 Jan September 30, 2010 at 4:45 pm

So how would I create a shortcut that would change my home and then start explorer?

4 Tim October 5, 2011 at 11:44 pm

And here is how it should actually look:

@echo off
set key="HKCU\Software\Microsoft\Internet Explorer\Main"
set value="Start Page"
set data="%1"
reg.exe add %key% /v %value% /d %data% /f

Note the “” around the %1

5 Steve Wiseman October 6, 2011 at 9:08 am

Hello Tim,

Thanks for taking the time to post this.

6 David December 13, 2012 at 2:43 pm

Hi Steve I know this is an old article (and honestly I wonder if you will even get to read this post but at least it can help someone else looking for this [this page is the first result in Google after all])
Why not just run a one line reg bat? For example:

@echo off
reg add “HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main” /v “Start Page” /t “reg_sz” /d “http://www.intelliadmin.com” /f

7 Steve Wiseman December 17, 2012 at 11:58 am

Hi David,

That actually is a better option. At that time I might have forgotten about “reg add”

Thanks for the post,

Steve

8 Mike Powers June 4, 2013 at 3:46 pm

Very helpful script. I didn’t realize there was a reg.exe command, I’ll be using that more to automate things.

However, copy/paste did not work and it took a bit of playing around (I finally realized I could just put the ‘pause’ command in at the end of the script to stop Windows 7 from closing the window and clearing out my returns.) The problem is this: the website formatting changes the dumb quotation mark (ASCII 0x22) to smart ones (ASCII 0x93 and 0x94). The CMD line does not deal with the smart quotes and the command produces an Invalid Key Name error.

@Tim
Good work presenting as plain text. This fixes the problem. And that is actually why code should always be pasted as plain.

@Chris
You are mistaken, the quotes can be in either place. The problem lies in what character was used for the quotes; when you deleted them and retyped them in a different location you unknowingly corrected the problem.

9 Mark Collins August 22, 2014 at 8:22 am

Just wanted to note yes the quotes are the issue just retype them to fix.

Heres mine – likely website is changing it with FONT type.

echo Y | start /wait Reg.exe add “HKCU\Software\Microsoft\Internet Explorer\Main” /v “Start Page” /t “reg_sz” /d “http://www.markcollins.ca” /f

Leave a Comment

Category Links - Windows Forum - Exchange Forum