September 21, 2006

Two nifty open source tools for portable Windows computing

Author: Dmitri Popov

Creating a portable computing environment is not that difficult: just copy the portable applications you want to a USB stick or other removable media, and you're good to go. However, if you want to make your daily portable computing more effective, you have to solve at least two problems: managing portable applications and synchronising data between the USB stick and your computer.


A solution to the first problem is to use a dedicated application launcher such as PStart, which lets you launch applications from removable media via an icon on the Windows system tray. Although PStart is distributed free of charge, it's closed source software. ASuite is an open source clone of PStart, but with a few clever features of its own.

To "install" the launcher, download the latest version of the utility, and copy the ASuite folder onto your USB stick. When you launch ASuite, it places an icon in the system tray and opens its main window, which has three tabs: List, Search, and Stats. To add applications to the launcher, simply drag their executable files onto the List window. Alternatively, you can let ASuite locate applications on your USB stick automatically by choosing File > Scan for executables. You can group the added applications into folders, which can come in handy if you have many programs on your USB stick. If you want to launch several applications simultaneously, you can create a software group. For example, you can create a software group for Internet applications such as Firefox, Thunderbird, and Miranda IM, and then launch them all with a single click.

Once you've added an application, you can tweak its properties by right-clicking on it and choosing Properties or pressing F5. Here you can specify things such as custom working directory, custom icon, and auto-execute options. While in most cases you might want to leave these settings as they are, there are situations when you need to specify them in order for the application to run properly. For example, WordNet is not specifically designed to run from a USB stick, but you can make it run from a removable drive by specifying a custom working directory and custom icon (E:\WordNet 2.1\bin and E:\WordNet 2.1\bin\wn.ico respectively, assuming your USB stick is mounted with the letter E). Finally, ASuite supports multiple languages, and if you want to localize ASuite, you can translate the english.xml file in the Lang folder into your language, and save it with a different name. In ASuite, choose then File > Options, and select the appropriate language file.

Using Unison to synchronize data

The second problem is to keep data in sync between your USB stick and computer. This includes documents as well as application data and preferences. For example, if you use Portable Firefox on your USB stick and Firefox on your computer, you might want to keep exact replicas of your profile, so you can seamlessly move from one application to another. There are quite a few utilities that can keep things in sync, but most of them must be installed on your host machine. A much better solution would be a portable tool that resides on your USB stick, so you can sync data with whatever machine you need. That describes Unison, a powerful yet easy-to-use file synchronizer.

To install Unison on your USB stick, download its command-line version (the unison-x.xx.x-win-text.exe file), rename the file to unison.exe, and move it into the root of the USB stick. Create a unison folder in the same location.

Although Unison is not designed to run from a removable disk, it will happily do so if you specify a couple of parameters. Since Unison is available as a command-line utility, you can write a simple batch script with all the necessary parameters and configuration options. Create a new text file and enter the following code, substituting the string that designates your own Firefox default directory:

  @echo off
  set unison=.\unison
  set USB_Path=.\FirefoxPortable\Data\profile
  set Local_Path=C:\Documents and Settings\User\Application Data\Mozilla\Firefox\Profiles\vmu5dry8.default

  echo Ready to sync %Local_Path%

  unison "%USB_Path%" "%Local_Path%" -batch -log -logfile log.txt -times -prefer newer

  echo All done! Details are in the log.txt file.

The set unison command specifies the alternate unison folder in the root of the USB stick. This prevents Unison from storing data in the default location on the hard disk. The next two commands define the synchronization directories. Unfortunately, Unison can't use relative paths, so you have to provide the exact paths to the folders and edit them manually later on, if needed. Finally, the unison command performs synchronization of the specified directories with the following parameters:

-batch performs synchronization without user interaction
-log -logfile log.txt enables logging and specifies a logfile
-times keeps the files' modification times
-prefer newer resolves conflicts by keeping the newest file

Save the file with the .bat extension and put it in the root folder of the USB stick. Before you synchronize the Firefox profile, do a couple of dry runs on dummy directories (remember to edit the USB_Path and Local_Path values accordingly) to avoid any potential problems.

Using this batch file you can synchronize not only Firefox profiles, but all sorts of data. Unison's manual provides a comprehensive description of Unison's features and options, which you can use to write more sophisticated scripts.

Dmitri Popov is a freelance writer whose articles have appeared in Russian, British, German, and Danish computer magazines.

Click Here!