Making the NX Client portable

NX is great. I’m deeply in love with it. Sometimes it’s acting like a real jerk, though. The NX Web Companion is installing a lot of crap into the active user’s profile. The NX client writes stuff in the active user’s profile. Both isn’t really convenient for me.

I prefer to have all my settings with me on a USB thumbdrive. So, in the spirit of PortableApps I’ll show you how to simply turn NX into a portable application.

First thing to do is installing NX client on a machine, if you have installed already – that’s fine. Copy the entire program folder to a new directory structure like NxClientPortable\App (I’ll follow the PortableApps schema here). In NxClientPortable create a new directory named “Data” and a batch file with the following contents:

@echo off

App\nxclient.exe %*

reg delete /f /va "HKCU\Software\Cygnus Solutions"
reg delete /f /va "HKLM\Software\Cygnus Solutions"

That’s it. Start the batch file and you’ll be fine. No need for installations, no files in some stranger’s profile. Everything goes back to your thumbdrive neatly.

This example also demonstrates why batch still isn’t dead: The USERPROFILE variable will be changed just within the scope of our batch file, all other applications will still use the path specified in the “global” instance of the variable.

Making Cygwin portable

One of the very packages I always install when I have to work with Windows is Cygwin. Being able to use my beloved GNU tools really makes things easier. Often I don’t have the option to install it. I grieved a little bit about the fact that some problems could be solved with just 2 commands that were — of course — missing from Windows’ horrendous command prompt. So I snooped around and built the following batch that’ll start a full-blown Cygwin session from i.e. portable harddisk:

@echo off set PATH=%CD%bin;%CD%sbin;%CD%usrsbin;%PATH set HOME=%CD%homePortable mount -bfu %CD%/ / mount -bfu %CD%bin /usr/bin mount -bfu %CD%lib /usr/lib cd %HOME% bash ----login -i

Easy, huh? All you have to do to make it work is renaming your /home/Username to /home/Portable (or simply adjust the setting in the batch). Pretty neat stuff.