How to download Internet Explorer 8 for Windows 7 E without any Web browser?

Michael Schwarz on Wednesday, July 15, 2009
Labels

Windows 7 RTM will be available in the next days and for all European users there will be no Internet Explorer 8. I’m not sure if there will be an option to install Internet Explorer from the setup DVD or if we can simple add this as a Windows feature in control panel.

Following command line batch file will download Internet Explorer 8 setup:

@echo off 

if exist download-IE8.cs del download-IE8.cs 

echo using System; > download-IE8.cs     
echo using System.Net; >> download-IE8.cs      
echo using System.IO; >> download-IE8.cs      
echo. >> download-IE8.cs      
echo namespace Download_IE8 >> download-IE8.cs      
echo { >> download-IE8.cs      
echo     class Program >> download-IE8.cs      
echo     { >> download-IE8.cs      
echo         static void Main(string[] args) >> download-IE8.cs      
echo         { >> download-IE8.cs      
echo             if (File.Exists("IE8-WindowsVista-x86-DEU.exe")) >> download-IE8.cs      
echo                 File.Delete("IE8-WindowsVista-x86-DEU.exe"); >> download-IE8.cs      
echo. >> download-IE8.cs      
echo             try >> download-IE8.cs      
echo             { >> download-IE8.cs      
echo                 HttpWebRequest request = (HttpWebRequest)WebRequest.Create("[http://download.microsoft.com/download/3/D/C/3DC5DC1B-2B60-487A-BAE2-732662BC0886/IE8-WindowsVista-x86-DEU.exe");](http://download.microsoft.com/download/3/D/C/3DC5DC1B-2B60-487A-BAE2-732662BC0886/IE8-WindowsVista-x86-DEU.exe");) >> download-IE8.cs      
echo                 request.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1;)"; >> download-IE8.cs      
echo                 request.AllowWriteStreamBuffering = false; >> download-IE8.cs      
echo                 request.Timeout = 10000; >> download-IE8.cs      
echo. >> download-IE8.cs      
echo                 using (Stream s = request.GetResponse().GetResponseStream()) >> download-IE8.cs      
echo                 { >> download-IE8.cs      
echo                     FileStream fs = new FileStream("IE8-WindowsVista-x86-DEU.exe", FileMode.Create); >> download-IE8.cs      
echo. >> download-IE8.cs      
echo                     byte[] read = new byte[1024]; >> download-IE8.cs      
echo                     int count = s.Read(read, 0, read.Length); >> download-IE8.cs      
echo. >> download-IE8.cs      
echo                     while (count != 0) >> download-IE8.cs      
echo                     { >> download-IE8.cs      
echo                         fs.Write(read, 0, count); >> download-IE8.cs      
echo                         count = s.Read(read, 0, read.Length); >> download-IE8.cs      
echo. >> download-IE8.cs      
echo                         Console.Write("."); >> download-IE8.cs      
echo                     } >> download-IE8.cs      
echo                 } >> download-IE8.cs      
echo. >> download-IE8.cs      
echo                 Console.WriteLine(); >> download-IE8.cs      
echo                 Console.WriteLine("Done."); >> download-IE8.cs      
echo. >> download-IE8.cs      
echo                 System.Threading.Thread.Sleep(5000); >> download-IE8.cs      
echo                 System.Diagnostics.Process.Start("IE8-WindowsVista-x86-DEU.exe"); >> download-IE8.cs      
echo             } >> download-IE8.cs      
echo             catch (Exception ex) >> download-IE8.cs      
echo             { >> download-IE8.cs      
echo                 Console.WriteLine("Error: " + ex.Message); >> download-IE8.cs      
echo             } >> download-IE8.cs      
echo         } >> download-IE8.cs      
echo     } >> download-IE8.cs      
echo } >> download-IE8.cs      
echo. >> download-IE8.cs 

if not exist download-IE8.cs goto ERROR1 

"%WINDIR%\Microsoft.NET\Framework\v3.5\csc.exe" download-IE8.cs 

download-IE8.exe 

if not exists download-IE8.exe goto ERROR2 

:ERROR1 

echo Could not create C# source file. 

goto END 

:ERROR2 

echo Could not create executable to download IE8. 

goto END 

:END 

Note: this is a first version of my script that will download Internet Explorer 8 German for Windows Vista (x86) only. If it is working I will modify it to have an option to choose the correct version you need. Well, if Microsoft is adding a checkbox to the Windows features in control panel we don’t need it.