Start C self updating application

C self updating application

On Windows for example, in %LOCALAPPDATA%/Google/Chrome/Application there is a small binary which is a stub that loads the main app code (in chrome.dll) from a versioned directory.

For more information on setting this property, see Choosing a Click Once Update Strategy.

You can also use the technique described below to deploy your application from one location but update it from another.

If you only need some of the app's content to be automatically updated, you could make it web content, with the app providing hooks to access any native functionality that is not normally available in the browser.

If you were to build your own system, the simplest approach might go something like this:1.

You can either rely on the user to restart the app themselves, do it automatically or perhaps give the user a little prompting after a while (Chrome and Firefox do this).

The approach I've outlined here is a simplified version of the approach Chrome uses.

Download the new version as an archive, extract to folder from step 1 (eg.

%LOCALAPPDATA%/Your Company/Your App/Your App 1.1) then mark the newly downloaded version as the 'current' version of the app.

In Windows you cannot write to an executable file while it is still running, because the file is locked by the file system. First the Batch-file deletes itself, then it starts the updated application.

Therefore a running application can never delete or update itself without the help of another process that does the actual work. They are interpreted line by line by command replaces the old version of the application with the new and updated one. The command is the actual command used to execute the Batch-file.

For Windows systems it uses the trick with the Batch-file from above.