Page 1 of 1

check for updates option

Posted: 23 Oct 2021 19:45
by AR Coding
Hi, i have a program that i want to add an option to the menu to check for updates for the program. Ive seen this thread viewtopic.php?p=14820#p14820 But i dont want it to actually download the file is that possible (Perferably no 3rd party executables)?
Here are the steps i want it to do:
1. Check if the file on the website is newer/has a higher version number
2. Prompt the user to download update
3. Download update

Thanks, AR :D

Re: check for updates option

Posted: 24 Oct 2021 04:21
by aGerman
The answer to "is this possible" is probably "yes". But there's no general way of how to do it. On an FTP server share you would probably read the file's date directly. On an HTTP(S) server share you certainly have to read and parse the HTML source text. And if the owner decides to update the appearance of the site, you'll most likely have to update your routines to parse it, too.

Steffen

Re: check for updates option

Posted: 25 Oct 2021 19:25
by Joe Caverly
As curl.exe comes with Windows 10, I use it to check the Last-Modified date of a file before I download said file.

Example;

Code: Select all

e:\utils>curl --head --insecure --silent "https://www.nirsoft.net/utils/csvfileview-x64.zip" | find "Last-Modified"
Last-Modified: Fri, 27 Aug 2021 12:37:30 GMT
Joe

Re: check for updates option

Posted: 25 Oct 2021 21:19
by AR Coding
Thanks for the suggestion Joe! i will use that, but i would perfer something that works for all versions, but thanks Anyway!
is there no vbscript/jscript/powershell hybrid ?

Re: check for updates option

Posted: 26 Oct 2021 01:10
by Squashman
Powershell code you can run from a batch file.

Code: Select all

powershell -command "$clnt = new-object System.Net.WebClient; $clnt.OpenRead('https://www.nirsoft.net/utils/csvfileview-x64.zip').Close(); $clnt.ResponseHeaders['Last-Modified']"
Output

Code: Select all

Fri, 27 Aug 2021 12:37:30 GMT

Re: check for updates option

Posted: 26 Oct 2021 05:04
by AR Coding
Thanks, Squaushman. your awesome! :)

Re: check for updates option

Posted: 26 Oct 2021 08:49
by Squashman
AR Coding wrote:
26 Oct 2021 05:04
Thanks, Squaushman. your awesome! :)
I always thank Google for having such a great search engine because that is all I did.

Re: check for updates option

Posted: 03 Nov 2021 20:44
by AR Coding
Squashman wrote:
26 Oct 2021 08:49
AR Coding wrote:
26 Oct 2021 05:04
Thanks, Squaushman. your awesome! :)
I always thank Google for having such a great search engine because that is all I did.
would you mind sharing the link to the website where you found that?

Re: check for updates option

Posted: 04 Nov 2021 05:55
by atfon
AR Coding wrote:
03 Nov 2021 20:44
Squashman wrote:
26 Oct 2021 08:49
AR Coding wrote:
26 Oct 2021 05:04
Thanks, Squaushman. your awesome! :)
I always thank Google for having such a great search engine because that is all I did.
would you mind sharing the link to the website where you found that?
I don't know where @Squashman found it specifically, but the post from Bacon-Bits on Oct 23 '14 is pretty close here:

https://stackoverflow.com/questions/265 ... powershell