check for updates option

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
AR Coding
Posts: 53
Joined: 02 May 2021 21:16

check for updates option

#1 Post by AR Coding » 23 Oct 2021 19:45

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

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: check for updates option

#2 Post by aGerman » 24 Oct 2021 04:21

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

Joe Caverly
Posts: 18
Joined: 11 Jul 2018 05:05

Re: check for updates option

#3 Post by Joe Caverly » 25 Oct 2021 19:25

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

AR Coding
Posts: 53
Joined: 02 May 2021 21:16

Re: check for updates option

#4 Post by AR Coding » 25 Oct 2021 21:19

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 ?

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: check for updates option

#5 Post by Squashman » 26 Oct 2021 01:10

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

AR Coding
Posts: 53
Joined: 02 May 2021 21:16

Re: check for updates option

#6 Post by AR Coding » 26 Oct 2021 05:04

Thanks, Squaushman. your awesome! :)

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: check for updates option

#7 Post by Squashman » 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.

AR Coding
Posts: 53
Joined: 02 May 2021 21:16

Re: check for updates option

#8 Post by AR Coding » 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?

atfon
Posts: 178
Joined: 06 Oct 2017 07:33

Re: check for updates option

#9 Post by atfon » 04 Nov 2021 05:55

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

Post Reply