Monday, February 13, 2006

Run IE7 Beta 2 Standalone in 5 easy steps

The IE7 Standalone mode is not offically supported so try this at your own risk. Use this only if you are a web designer and wish to see how your pages will render in IE7. If you want the full features of IE7 the best option is to install it without using this hack.

1) Download IE7 Beta2
2) Rename the file IE7B2P-WindowsXP-x86-enu.exe to IE7B2P-WindowsXP-x86-enu.cab
3) Open the file using WinZip or WinRar and extract the contents to any directory eg: c:\IE7
4) Create a new file IE7.vbs and copy the code given below into it. Save it into the directory where you extracted the files and save it as IE7.vbs


Option Explicit

Dim objFSO, objReg, objShell, tf, obj

const HKEY_CLASSES_ROOT = &H80000000
const HKEY_CURRENT_USER = &H80000001
const HKEY_LOCAL_MACHINE = &H80000002
const HKEY_USERS = &H80000003

Sub DeleteRegistryKey(LNGHKEY, strSubkey)
    Dim reg, aSubkeys, s
    Set reg = _
GetObject("WinMgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
    reg.EnumKey LNGHKEY, strSubkey, aSubkeys
    If Not IsNull(aSubkeys) Then
        For Each s In aSubkeys
            Call DeleteRegistryKey(LNGHKEY, strSubKey & "\" & s)
        Next
    End If
    On Error Resume Next
        reg.DeleteKey LNGHKEY, strSubKey
    On Error GoTo 0
End Sub

Set objReg   = _
GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
Set objShell = CreateObject("WScript.Shell")
Set objFSO   = CreateObject("Scripting.FileSystemObject")

Call DeleteRegistryKey(HKEY_CLASSES_ROOT, _
"CLSID\{C90250F3-4D7D-4991-9B69-A5C5BC1C2AE6}")
Call DeleteRegistryKey(HKEY_CLASSES_ROOT, _
"Interface\{000214E5-0000-0000-C000-000000000046}")

objReg.SetStringValue HKEY_LOCAL_MACHINE, _
"SOFTWARE\Microsoft\Internet Explorer\Version Vector","IE","7.0000"

objFSO.MoveFile "SHLWAPI.DLL", "SHLWAPI.DLL.BAK"

Set tf = objFSO.CreateTextFile("IEXPLORE.exe.local", True)
tf.Write (" ")
tf.Close

objShell.Run ".\iexplore.exe about:blank"  ',, true
WScript.Sleep 7000

objFSO.MoveFile "SHLWAPI.DLL.BAK", "SHLWAPI.DLL"

objReg.SetStringValue HKEY_LOCAL_MACHINE, _
"SOFTWARE\Microsoft\Internet Explorer\Version Vector","IE",""
Call DeleteRegistryKey(HKEY_CLASSES_ROOT, _
"CLSID\{C90250F3-4D7D-4991-9B69-A5C5BC1C2AE6}")
Call DeleteRegistryKey(HKEY_CLASSES_ROOT, _
"Interface\{000214E5-0000-0000-C000-000000000046}")


5) Now double click IE7.vbs to use IE7. You can also create a shortcut for IE7.vbs

If you want to use a batch file instead of a VBScript file you can try this out. I take no credit for this script. I just converted the batch file into a VB Script, for more information check this out . The main reason for using a VB Script file was that when you use the batch file a console window remains open till IE7 is being executed. The other reason is that when IE7 is being extecuted IE6 will not work. If you use the VB Script you can use IE6 and IE7 at the same time.

Technorati Tags: ,

19 comments:

Alex Walker said...

Hi Vivek,

Nice work on the script. Seems like an improvement on the batch file, but I VBscript isn't my strong point, so I wanted to understand a little more about it before I linked to it.

Two questions.

1) From reading Jon's explanation, his original batch file hangs around after you close IE7 to perform some sort of clean-up function. Closing the batch file before IE7 gets you into trouble. Does your VBScript persist after IE7 launches? Does it need to?

2) Is it common for people to have the VBS file format disabled because of perceived virus concerns?

Vivek Jishtu said...

1) Even in this script it waits for two seconds for IE7 to start before it performs the cleanup. If the cleanup occurs before IE7 starts up it will flash and then close down, something like if you double click iexplore.exe right now.

2) Since the script engine is built into the OS I really doubt people can turn it off that easily. Atleast I don't know a way of turning it off :), so I guess most people don't know how to turn it off.

Alex Walker said...

Cool, Vivek.

I have a vague memory from a few years ago where people were disassociating the VBS file type with any WScript so VB viruses couldn't run easily.

Anyway, I got it running here. Certainly more elegant than the batch file. Great work.

Nathan Mallamace said...

This seemed to work after not being able to uninstall my IE7 beta 1. I haven't noticed any terrible side effects of doing it this way. As a side note: I had to turn off virus script warnings & "allow script to run once." Furthermore, I had to run the script two times in order to get IE7 beta 2 to load all the way. Seems to be working fine for the moment.


Now I just wish I had someway of UNINSTALLING IE7 Beta 1.

Vivek Jishtu said...

If you are on a somewhat slow machine change WScript.Sleep 2000 to WScript.Sleep 10000. This is the time after which the script performs the cleanup. Right now its set to 2 seconds or 2000 miliseconds.

Anonymous said...

The script doesn't open, the message is: deactivated windows host scripts - contact you admin (I am the admin of my pc) What's to do?

GiorgosKontopoulos said...

By the way Vivek nice work!

Just a comment some people might find usefull.

If anyone has other IE standalone versions (IE5 IE5.5...) and has applied the hacks to fix the Conditional Comments as described in http://www.positioniseverything.net/articles/multiIE.html might need to erase (from the script) the two lines that create and change the IE variable from the "Version Vector" key, since the script undoes the previous hacks.

My IE7 does not seem to complain by me erasing lines 35-36 and 49-50 from the script.

michiel said...

I don't know if my problems have been caused by the script but they are the following:
- sudden computer shutdowns
- crashes of windows
- IE7 could not connect to the internet, despite having the exact IE6 proxy and network settings
- all programs installed seemed to be 'run for the first time'.
- all network drive mappings had disappeared

IE7 BETA 1 was installed before and succesfully uninstalled before we followed your instructions meticulously.

We have Windows XP SP2

Vivek Jishtu said...

Hi Michiel,

It looks like you have a spyware or a virus. This script just renames a file and removes a registry entry. You can try out the batch file that does the same thing. The only reason to use this script is to get rid of the console window and run IE6 and IE7 side by side, other than that you can use the batch file if you like.

Anonymous said...

How come IE6 and IE7 can run side by side just because it's a VBScript and not a batch file?

Vivek Jishtu said...

The VB Script does not wait for IE to end, like in the case of the batch file. It just waits for 2 seconds so that IE7 gets the registry entries it is looking for. After two seconds the entries are deleted and you can start IE6 alongside.

Jens said...

Hi!
I'm having trouble using your script. It fires IE7 up, but immediately hangs, with iexplore.exe firing away abou 80-90% of the cpu power until i close the process. Any suggestions?

Anonymous said...

Hi,

great script! Unfortunately, I do find the startup rather slow, and at least one feature is missing in IE7 via script - dynamic zooming.

Impressive anyway :)

Chris said...

It works for me - but is it possible to get it to run from inside dreamweaver?

Scott Blumenthal said...

Vivek,
Thanks for the script. Seems to be working great. One question: have you or anyone else had problems with this standalone version of IE7 conencting through a proxy server? IE7 seems to have gotten my settings from IE6, and I can view localhost, but can't seem to view anything at large. Just wondering if you had any thoughts or experience with this issue. Thanks again for sharing the script!

netdragon said...

I have to right click and choose "Open in Command Prompt" to get it to work. I can't just double-click it because it just opens Notepad.

netdragon said...

I figured it out. There's two programs to run vbs scripts, one called wscript and one called cscript.

Anonymous said...

Hi Vivek, I just want to let you know that there is a launch script available for IE7 beta 3. You can read more about it here

Anonymous said...

hey im in embedded s/w development n dont knw ne thing abt vb scripting..we've a vb script which is used for some code generation..recently we migrated to a new server.
Now the problem is when i run this VB script..i get the following
error
================================
Line 181
char 3
error : cannot find the file specified
code : 80070002
source : WshShell.exec
================================

line 181 :
Set oExec = WshShell.Exec(cmd)

in code cmd is set to some .exe file and that is present

can u help dude

naveen.mr@gmail.com