Firefox profile on a flash drive

firefox-tuning

I regularly use a computer at my workplace. This computer multiple people use so it is setup not to save Firefox’s settings. I use it enough, in specific ways, that I decided to find a way to use it with settings available.

I take a flash drive with me to be able to access various personal documents and programs. I had heard about web browsers being installed on flash drives; after I thought about it awhile, I realized all I would be required to do is put a profile on it.

The flash drive I have is formatted FAT32 to be able to use with Windows (my work computer) and I keep my flash drive organized similar to my Linux home directory for convenience. First I created a directory for the profile:

mkdir -p ~/.mozilla/firefox/profile/ANAME

Then I create the profile—from the command prompt this command will get the job done:

start firefox.exe -CreateProfile "MyName D:\.mozilla\firefox\profile\ANAME"

start-menu-example

(Or alternately I could have typed firefox.exe -P from the start menu and used the GUI version.)

I started the profile then to have the necessary files created. After it got done loading, I quit Firefox and I deleted the profile managers knowledge of the profile but not the profile itself (see example picture).

With the profile created all required effort left to be done is to instruct Firefox of the profile’s location. I put this in a batch script so that I can regularly use it:

@echo off

:: http://stackoverflow.com/a/15815897
:: http://stackoverflow.com/q/154075

set HOMEDRIVE=%cd:~0,2%

if exist C:\PATH\TO\firefox.exe start /b C:\PATH\TO\firefox.exe -profile %HOMEDRIVE%\.mozilla\firefox\profile\toddweed && exit

if exist C:\PATH\TO\firefox.exe start /b C:\PATH\TO\firefox.exe -profile %HOMEDRIVE%\.mozilla\firefox\profile\toddweed && exit

if exist C:\Program Files\Mozilla Firefox\firefox.exe (
  start /b C:\PATH\TO\firefox.exe -profile %HOMEDRIVE%\.mozilla\firefox\profile\toddweed
) else (
  echo Firefox executable not found.
)