Jump to content

Programmatically update your applications


Recommended Posts

Here's what I do for some applications that use the same filenames for every version (acdseepowerpack.exe, aawsepersonal.exe & defs.ref, GoogleToolbarInstaller.exe, putty.exe, etc): place a batch file named "UPDATE.BAT" in the same directory as the program (you need to have wget installed on your system and in your PATH. The batch file does this:

Example:

@PUSHD "%~dp0"
WGET --timestamping "http://files.acdsystems.com/english/downloads/acdsite/acdseepowerpack.exe"

That will change the current directory to the path where the batch file is located and then wget the latest version, the "--timestamping" option is for "don't re-retrieve files unless newer than local."

This simplifies the task of updating some of your applications before you burn a fresh install CD.

And if you want to get even fancier, make a batch file UPDATEALL.BAT in the parent directory to all of your applications, in my case it is in my $OEM$ directory - which contains this:

@PUSHD "%~dp0" & ECHO OFF

FOR /F "tokens=*" %%x IN ('DIR /A /B /S "UPDATE.BAT"') DO @"%%x"

This batch will look through each directory and execute the UPDATE.BAT if its found, so to update all of your programs you just click a single batch file.

For applications that use a different filename for each new version, I came up with a solution but its not as simple and clean, and wont work if the page layout for the download link changes.

Example for Nero:

@PUSHD "%~dp0" & SET URL="http://nero.com/us/download_demo.php?pak=1"

@wget -O- %URL% | awk '/.*If your download does not start.*/ { split($9,url,"\""); print url[2] > "current.txt"; }'

That will wget the page that contains the link to the latest Nero EXE and pipe the html into 'awk' and spit out the url to 'current.txt', from there you can use IF statements in a batch file etc to see if you have the same file, and if not, wget the latest one.

I just though I'd share some of my tricks and such that I've come up with, and if you have any suggestions or tips for ideas, I'd like to hear them.

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...