Up to last part, I always booted Linux. In this part (and only this one), I boot Windows. Then I insert the flash drive; let’s assume later on, that the flash drive’s letter is D:. In the first part, I wrote that all non-data folders should be hidden from both Linux and Windows; the targeted folder is .boot, which is hidden from Linux but not yet from Windows. Do this now: in the properties for .boot, make it hidden (no need to do it recursively).

Now the applications. First I create a D:\.wapps folder; the name can be different as long as there is no space (a precaution in case some applications don't like them) and the name starts with a dot (this makes the directory hidden in Linux). This folder will contain all the Windows portable applications; those I want to install are:

  • Firefox and Thunderbird for daily Internet usage,
  • Gimp for the occasional graphics work,
  • KeePassX, a cross-platform tool to securely store miscellaneous passwords,
  • KiTTY, a better Putty, to easily run all sorts of SSH-based tasks (except SFTP),
  • LibreOffice, the well-known office suite,
  • Cygwin, without which my usage of Windows would feel crippled,
  • and VirtuaWin, the final touch to remind me of $HOME ;-)

I will install the Portable applications first; they are the easiest to deal with. For each of Firefox, Thunderbird, Gimp, KiTTY, LibreOffice, and VirtuaWin, I only have to follow these steps:

  1. download and run the exe file,
  2. optionally select the language and options if asked,
  3. browse to D:\.wapps for the installation directory, and remove the useless “Portable” in the proposed name, for example: D:\.wapps\Firefox,
  4. click Install.


  • Alongside FirefoxPortable.exe (in the same folder), I suggest you create a shortcut to it named Firefox-noremote.exe, then open its properties, and append “ --no-remote” (without the quotes) to the Target line. Use this exe instead of the provided one; it will allow you to run this Firefox even if the computer’s Firefox is already opened.
  • In case you want to add custom fonts to LibreOffice, they should go to D:\.wapps\LibreOffice\App\Fonts.

Now KeePassX. The ZIP file contains a KeePassX folder, which I unzip to D:\.wapps\. Then I drop into this folder a new file named KeePassXPortable.vbs with this contents:

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "\.wapps\KeePassX\KeePassX.exe \path\to\your\file.kdb -cfg \.wapps\KeePassX\config.ini", 1
Set WshShell = Nothing

The \path\to\your\file.kdb is the path to your KeePassX data file (if you have one on the flash drive), relative to the root of the drive; if you don’t have such a file on the drive, or don’t want to auto-open it, then just leave this part out of the file. Then be sure to always run KeePassXPortable.wbs instead of KeePassX.exe, else the application won’t behave in a portable way.

Finally, I will install Cygwin, the hardest one to run in a portable way, and the main reason I abandoned NTFS… First, I create a D:\.wapps\Cygwin folder, inside of which I download the installer (setup.exe):

  1. I run the installer and choose “Install from Internet”.
  2. For the “Root Directory”, I choose D:\.wapps\Cygwin\Cygwin, and I leave other options as they are.
  3. For the “Local Package Directory”, I choose D:\.wapps\Cygwin\Download.
  4. The Internet connection settings should be set according to the way the computer is connected.
  5. In the mirror list, I select http://mirror.switch.ch, which is reliable in my experience (no missing packages).
  6. The selection of software then begins. I suggest you select at least these to be installed: xinit, screen, xterm, rxvt, rxvt-unicode-X, luit, grub (version 2), openssh, openssl, p7zip; the installer will take care of dependences.

Cygwin is not portable as it is. However, using some information from the net, in particular the good ideas from “Coding With Spike!”, I was able to obtain a working portable Cygwin.

I first choose a Cygwin user name that will be used across all computers; I choose “usb” (but you can choose otherwise) so I create this folder: D:\.wapps\Cygwin\Cygwin\home\usb.

I also create this folder: D:\.wapps\Cygwin\ProgramData. And I create a reg file, that is stored for convenience as D:\.wapps\Cygwin\Download\clean.reg; here is the content of this file:




Then, in the D:\.wapps\Cygwin folder, I create a file named CygwinPortable.bat, with this content:

@echo off
set CYG_HOME=%~d0\.wapps\Cygwin

set USERNAME=usb
set path=%CYG_HOME%\Cygwin\home\%USERNAME%\.local\bin;%CYG_HOME%\Cygwin\bin;%CYG_HOME%\Cygwin\usr\X11R6\bin;%path%
set ProgramData=%CYG_HOME%\ProgramData
set LOCALAPPDATA=%ProgramData%
set APPDATA=%ProgramData%
set HOME=/home/%USERNAME%
set TMP=/tmp
set TEMP=%TMP%
set PUBLIC=%~d0\
set CYGWIN=nodosfilewarning
set GROUP=None
set GRP=
set SHELL=/bin/bash
set DISPLAY=:0

REM If this is the current user’s first time running Cygwin, add them to /etc/passwd
for /F %%A in ('%CYG_HOME%\Cygwin\bin\mkpasswd.exe -c ^| %CYG_HOME%\Cygwin\bin\gawk.exe -F":" '{print $5}'') do set SID=%%A
findstr /m %SID% %CYG_HOME%\Cygwin\etc\passwd
if %errorlevel%==1 (
echo Adding a user for SID: %SID%
for /F %%A in ('%CYG_HOME%\Cygwin\bin\gawk.exe -F":" '/^%GROUP%/ {print $3}' %CYG_HOME%/Cygwin/etc/group') do set GRP=%%A
if "%GRP%" neq "" (
echo Adding to Group number: %GRP%
%CYG_HOME%\Cygwin\bin\printf.exe "%USERNAME%:unused:1001:%GRP%:%%s:%HOME%:/bin/bash\n" "%SID%" >> %CYG_HOME%\Cygwin\etc\passwd
set GRP=
set SID=
set GROUP=

REM Actually run Cygwin.
chdir %CYG_HOME%\Cygwin\home\%USERNAME%

%CYG_HOME%\Cygwin\bin\umount -U
regedit /S %CYG_HOME%\Download\clean.reg

Three lines up from the end of the above file, I wrote an all-caps place-holder line; this must be replaced with one of the following, or an adequate alternative. The commands you choose must not end before you’re done with using Cygwin.

Alternative 1 (the one I recommend):

%CYG_HOME%\Cygwin\bin\startxwin /bin/xterm -geometry 120x40 -bg black -fg grey -fn 7x13 -- :0 -multiwindow -hostintitle
sleep 5
for /F %%A in ('tasklist /FO CSV /NH /FI "IMAGENAME eq XWin.exe"') do goto XEXISTS

This will make XWin start, as well as an XTerm. Cygwin will quit and house-clean when you exit XWin from the Windows tray. If you’re familiar with the screen command, you may want to add “-e screen -AU ” just before “--” on the first line.

Alternative 2:

%CYG_HOME%\Cygwin\bin\rxvt -geometry 120x40 -bg black -fg grey -fn 7x13

This will run a nice neither-X-nor-DOS terminal window. Cygwin will quit and house-clean when this terminal window closes. If you’re familiar with the screen command, you may want to append “ -e screen -A” to this line.

Alternative 3:

%CYG_HOME%\Cygwin\bin\bash -li

This will simply run the shell. Cygwin will quit and house-clean when this shell closes. If you’re familiar with the screen command, you may want to append “ -c "screen -A"” to this line.

Unless you choose the third alternative, you’ll also need a script that will launch the above bat file without the untimely DOS window appearing on screen. I name this script CygwinPortable.vbs, and here is its content:

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "CygwinPortable.bat" & Chr(34), 0
Set WshShell = Nothing

The portable flash drive is now ready. Next blog post will go back to TinyCore Linux, and offer possible improvements.