Taking It Easy

Stuff, things and wotnot

Auto Updater

I wrote this for Screwt. Simply provide it with a couple of command line parameters and you have a program that will check to see if a program has been updated, then show an info file, download a zip file, unpack it and re-launch the updated program.

Using the command line parameters you can modify how the updater works too. So if you don't want a program relaunched you don't have to. Also you can suppress the display of the information file.



System Requirements

Microsoft Windows 9x, NT 4.0, 2000 and XP
Internet Explorer 3.0 or higher (uses URLDownloadToFile function which is part of IE)


Simply download the file and unzip it. All you need is the AutoUpdater.exe file!


Auto Updater V1.0.1 Rev 2 - 47.9Kb Download...
Visual C++ Sourcecode - 1.35MB Download...


Command Line

autoupdater.exe [-v CurrentVersion] -s SourceUrl -d InstallPath [-r AppEXE AppPath] [-noinfo]


[optional] -v VersionNumber

Specifies the current version number of the software or data to be updated. VersionNumber can be any string which will be compared to the first line in the info text file.

-s SourceURL

Specifies the remote location of the zip and text file. SourceURL must be a valid URL pointing to the fully qualified location and filename (without the extension). You may also provide the URL as ftp://username:password@myftpsite.com/dir/file so that the file can be downloaded using FTP.

-d InstallPath

Specifies the local location where the zip and text file will be downloaded to. The zip will be unpacked into this directory too.

[optional] -r AppEXE AppPath

Specifies an executable file and location to run after the update has completed or been cancelled. If this is not included on the command line then the update will simply complete and close.

[optional] -noinfo

A switch that will suppress the showing of the info text file.


The application performs the following tasks:

1) If the -v parameter is supplied or the -noinfo switch is omitted then a text file at SourceURL with the extension .txt will be downloaded to the InstallPath.

2) If the -v parameter is supplied and the VersionNumber is the same as the first line on the text file downloaded at stage one then the update is aborted, goto step 7.

3) If the -noinfo switch is omitted then the text info file is launched and the application whats for the text file viewer to be closed. (Note the system default .txt file application is launched i.e. notepad).

4) If the -noinfo switch is omitted then a prompt will ask if the user wants to update the software. If 'No' then the update is aborted, goto step 7.

5) The zip file specified at SourceURL with the extension .zip will be downloaded to the InstallPath.

6) The zip file will be unzippped into the InstallPath, keeping all internal zip folders too.

7) If the -r parameter is supplied then the executable specified in AppEXE at the location AppPath is executed.


autoupdater.exe -v -s http://www.mydomain.com/folder/nameofprog -d "c:\program files\nameofprog" -r program.exe "c:\program files\nameofprog" -noinfo

In the example the file http://www.mydomain.com/folder/nameofprog.txt will be downloaded and the first line checked against the version number which was supplied ( If it is different in any way then it will be considered valid to update.

Because the -noinfo switch was supplied the text file downloaded will not be displayed. If you want the text file to be displayed then dont supply the -noinfo switch. In this case the text file will be opened using the associated default windows editor (i.e. notepad for most people). The software will then wait till the text file editor has been closed before prompting the user if they wish to update the software.

The file http://www.mydomain.com/folder/nameofprog.zip will then be downloaded and unzipped into the c:\program files\nameofprog folder. Note that all duplicate files are overwritten in this process.

Because the -r parameter was supplied when the unzipping has completed the executable file c:\program files\nameofprog\program.exe will then be run.

Also note that the text file and zip file are downloaded into the InstallPath (in the example its c:\program files\nameofprog). They will remain there even after the autoupdater closes. They will have the names updateinfo.txt and updatepack.zip

Remember the info text file is there for two purposes. 1) It tells the updater the version of the software held in the zip file. This is the first line of the text file. 2) It contains any other information you wish to show the user below this first line. A typical info file may look like this:

** SuperProggy Pro For Windows **

This update contains the latest version of your software. Lots more improvements coming soon!

Thank you for using this software. Please email any comments and suggestions using the link in the program or at the end of this document.

Changes in this version:
- fixed bug with HardwareCard 1.3
- added a super feature to the main thing

Joe Bloggs

webby: www.takingiteasy.co.uk
email: myprog@mydomain.com

Further Usage

Not only do I call autoupdater.exe in my Visual Basic programs to perform updates but I also use it to download and install new IDE files for my anti-virus software from Sophos.

To use it in Visual Basic, see the example code snippet below:

Dim vRet As Variant
Dim sCmdLine As String
' build a suitable command line
sCmdLine = "Auto Updater.exe"
sCmdLine = sCmdLine & " -v " & Chr(34) & "Version " & App.Major & "." & App.Minor & "." & App.Revision & Chr(34)
sCmdLine = sCmdLine & " -s " & Chr(34) & "http://www.mydomain.com/folder/myprogram" & Chr(34)
sCmdLine = sCmdLine & " -d " & Chr(34) & App.Path & Chr(34)
sCmdLine = sCmdLine & " -r " & Chr(34) & App.EXEName & ".exe" & Chr(34) & " " & Chr(34) & App.Path & Chr(34)
' run the program
vRet = Shell(sCmdLine, vbNormalFocus)
' close the window and end the program
Unload Me

To use it to update your IDE files for Sophos, create a shortcut which points to autoupdater.exe. Open up the properties of the shortcut and in the target box add the following after the filepath with Auto Updater.exe:

-s http://www.sophos.com/downloads/ide/ides -d "C:\Program Files\Sophos SWEEP for NT" -noinfo

Note: you may need to change "C:\Program Files\Sophos SWEEP for NT" depending on where you installed Sophos. Also ensure that this update method is suitable for your version of Sophos Sweep. Another way of doing this is to use their SGET command line download tool. However you need to manually unzip the files after SGET has downloaded the file.

So all you need to do to update your IDE files is double click the shortcut. This will download the ides.zip file from http://www.sophos.com/downloads/ide/ and unzip it into "C:\Program Files\Sophos SWEEP for NT". Naturally you don't need to use a shortcut to do this. You could schedule a system event to call autoupdater.exe with the appropriate command line parameters.

ToDo List / Ideas / Known Issues

Version History - fixed bug when the -noinfo option was selected causing the update file to be downloaded twice! - first released



I decided the existing server browsers didn't do it for me. So I wrote my own. Like you do.

Auto Updater

Screwt needed a way to update itself without bothering the lazy gamers I played with. This was the result.

Virtual Static IP

Back in the old days there weren't many good options for managing dynamic IPs, this project didn't get far.