There are times when you are working with a machine possibly an older machine where the browser does not support whatever web site or operation that you need it to. You know the scenario – you need to log on to a site or url to download software and the browser won’t render the site correctly – or worse still won’t let you download another browser to get round it. In the past I have always had access to an FTP server where I could store the necessary files and applications that could work around the issue but in a recent case I decided to look at some other options – preferably something that would work on most Windows based machines to get out of this situation. this tip is Windows specific but could easily be adapted to other scripting languages.
So this relates to getting a copy of Chrome on to the machine but as you can see it would be relatively easy to apply to an alternative browser such as Chrome – or other files / resources you might need. I found a script that had pretty much everything I needed here. I will reproduce the code here to illustrate a few points that may help
Firstly – this version is correct as of May 2015
strFileURL=”https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B615D7825-2EBC-2F94-69DC-163445BD63D5%7D%26lang%3Den%26browser%3D3%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dtrue%26installdataindex%3Ddefaultbrowser/update2/installers/ChromeStandaloneSetup.exe”
‘ This is where the file will download to.
strHDLocation = “c:\temp\Chrome.exe”
‘ Fetch the file
Set objXMLHTTP = CreateObject(“MSXML2.XMLHTTP”)
objXMLHTTP.open “GET”, strFileURL, false
objXMLHTTP.send()
If objXMLHTTP.Status = 200 Then
Set objADOStream = CreateObject(“ADODB.Stream”)
objADOStream.Open
objADOStream.Type = 1 ‘adTypeBinary
objADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0 ‘Set the stream position to the start
Set objFSO = Createobject(“Scripting.FileSystemObject”)
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
Set objFSO = Nothing
objADOStream.SaveToFile strHDLocation
objADOStream.Close
Set objADOStream = Nothing
End if
Set objXMLHTTP = Nothing
You need to download the code above and put into a text file – say using notepad. Save it into c:\temp on your pc and call it Chrome.vbs. Make sure the first line ends with the .exe”
Start a DOS session and change to c:\temp
Then run the script with cscript chrome.exe
This should download the executable you need to do the install of Chrome. The difficulty with the script however is that the location of the latest current download may/will change. So how do you check what the latest is ?
On a machine with a current working browser go to the chrome site (use google home page) – and select the link to download for example https://www.google.com/intl/en/chrome/browser/desktop/index.html?system=true&standalone=1#eula then click on accept and install – HERE comes the trick !!
When the next page is displayed for example https://www.google.com/intl/en/chrome/browser/thankyou.html?standalone=1&system=true&platform=win&installdataindex=defaultbrowser
Look at the bottom of the page for the text “If your download does not begin, please click here to retry. ” and right click on the hyperlink and in Internet Explorer select “Copy Link Location”
Paste that line into notepad for example
https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B615D7825-2EBC-2F94-69DC-163445BD63D5%7D%26lang%3Den%26browser%3D3%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dtrue%26installdataindex%3Ddefaultbrowser/update2/installers/ChromeStandaloneSetup.exe
and use that link to replace what comes after the strFileURL= statement and surround it with double quotes. Save the script and rerun it to get the latest Chrome version. You can then install from that.
If you want to adapt the script for others then look to change the StrFileURL value and the strHDLocation = “c:\temp\Chrome.exe” statement to reflect the real download you are making for example firefox.exe instead.
PS I have attached the text version of the code – download and rename to chrome.vbs in the c:\temp folder -> chrome.vbs code