check for updates option
Moderator: DosItHelp
check for updates option
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
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
Re: check for updates option
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
Steffen
-
- Posts: 18
- Joined: 11 Jul 2018 05:05
Re: check for updates option
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;
Joe
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
Re: check for updates option
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 ?
is there no vbscript/jscript/powershell hybrid ?
Re: check for updates option
Powershell code you can run from a batch file.
Output
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']"
Code: Select all
Fri, 27 Aug 2021 12:37:30 GMT
Re: check for updates option
Thanks, Squaushman. your awesome!
Re: check for updates option
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