I need to download latest file from website without using wget or any external utility. I found following vbscript on stack overflow itself (didnt know link, because I have cleared the cache and history)
' Set your settings
strFileURL = "http://somewebsitehere.com/somefile"
strHDLocation = "D:\somepath\"
' 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
However after using this script, I found it did work correctly for first few trials but later download same file from cache instead of downloading the fresh file from net. I get same file from C:\Users\username\AppData\Local\Microsoft\Windows\INetCache\IE\0XQSU247. I need to clear the INETCache and then re run the script to get the fresh file. So how should this script be modified so it gets latest updated file from web server instead of getting files from cache. This question might be lame, but I have no knowledge of vbscript.