Category Archives: windows_tricks

“One-touch” app installation and update with SVN

One of my responsibilities at work is to develop and distribute several applications to a different division. These apps all consist of an exe (we’re a Windows shop), some supporting files and an INI config file. They need to be run on several independent PC’s.

The division I am supporting does have technicians, but they are neither hugely technically competent nor blessed with much time to get stuff done, so a “one-touch” installation or update procedure is desired.

There are several ways this could be done, perhaps by distributing an MSI installer which is then installed on each PC. Here is another technique which works for me. It leverages SVN, both because that’s where my code lives and because both sides of this game have access to our SVN server.

  1. Ensure the exe and additional files are under SVN control.
  2. Tag the version of the exe which should be distributed. This will be svn://path/to/current/tag
  3. Create an SVN location with a name something like “current_location“. A good location would perhaps be in the SVN folder of the project, but it really only matters that it is somewhere in your SVN tree.
  4. Check the “current_location” directory out to a local working copy.
  5. Create an svn:external property on this working copy, like so:
    app svn://path/to/current/tag
    Check the “current_location” directory back in.
  6. On each PC the app is to run on, checkout the “current_location” directory. The app will be in a directory called “app” in the checkout location.

The “current_location” directory is now effectively a pointer to the version of the app in current use.

When the app needs updating, create a new tag and edit the svn:external property of your local copy of the “current_location” directory to reflect the new tag and check in. Instruct the technicians to SVN update on their side. This could be done by right-clicking in Windows Explorer via TortoiseSVN for eg.

For a more one-touch solution, I also provide a Windows batch file to automate the checking out of the app on the technicians’ side. This can be quite easily done using the SVN command line implementation made freely available by collabnet (it is of course even easier to do on Unix).

There are some further Windows tricks you can use to make the batch file more comprehensive and useful, but this is enough for now. I’ll write about enhancing the batch file in a (hopefully short-term) future post.

Leave a Comment

Filed under svn, windows_tricks, work

Setting permanent environment variables on Windows via command line

Some of our internal tools at work require a number of environment variables to be set to a variety of different options, depending on the project. This can be done with set, but that only changes the value for the life of the command shell you run set in. If stand-alone apps require those environment variables, they need to be set for the system. I used to be resigned to doing this by going to the System settings (via Control Panel or a right-click on My Computer and selecting Properties), selecting Advanced Options and clicking the Environment Variables button. The variables can then either be edited one by one in a tedious multi-dialog process, or new ones added in an equally tedious process. This is especially irritating if, like me, you would prefer to use the keyboard for most tasks.

But now the drudgery has been lifted – I have found setenv.exe! This terrific little tool allows user and system env variables to be set at the command line – so setting or altering the variables now becomes a sequence of commands like

setenv.exe -m NAME VALUE

I have no idea who wrote this tool, but whoever you are, thank you, from the bottom of my heart.

EDIT: I know who wrote it now – many thanks to Vincent Fatica.

Leave a Comment

Filed under computing, Uncategorized, windows_tricks