You are here

Firefox Multiple Profiles : the easy way

6 posts / 0 new
Last post
Fxp
Offline
Last seen: 13 years 3 months ago
Joined: 2008-03-07 10:44
Firefox Multiple Profiles : the easy way

You can have multiple portable profiles in three little steps. Still, you won't be able to run them at the same time.

STEP 1 : Create the profiles

The normal architecture of the firefox portable folder is:

-FirefoxPortable
   -App
   -Data
   -Other

You need to create multiple "Data" folders (one for each profile) in firefox portable. You can either keep "Data" as the default folder, or just erase it. You can name the folders as you wish. You can replace profile1, profile2, profile3, by Serious, Naughty, extensionTester if you prefer.

-FirefoxPortable
   -App
   -Profile1
   -Profile2
   -Profile3
   -Other

The pofiles folders are empty. This is normal. Firefox will fill them with the default profile content (stored in the app folder, if you want to check).
If you want to put your existing profiles datas, it is the right moment. Just paste the content of your profiles, in the folders.

STEP 2 : Create the ini files

Firfox Portable apps configuration can be changed through a file called FirefoxPortable.ini
Fetch the one in FirefoxPortable / Other / Sources and copy it in the FirefoxPortable folder.

If you edit it, you see that two lines are pointing at the old Data folder.
Save three copies of this file in the same directory, after changing the "Data" name to your corresponding profile:

  • FirefoxPortableProfile1.ini :

    ProfileDirectory=Profile1\profile
    SettingsDirectory=Profile1\settings
    
  • FirefoxPortableProfile2.ini :
    ProfileDirectory=Profile2\profile
    SettingsDirectory=Profile2\settings
    
  • etc...

STEP 3 : Start them

Ok, you just have to create a little .bat file to overwrite the FirefoxPortable.ini with the ini of the profile you want to use.

Profile1.bat

copy /Y FirefoxPortableProfile1.ini FirefoxPortable.ini
FirefoxPortable

(don't forget to add a carriage return after the last line, otherwise it will not be executed)

You can have as many bat to start all your profiles, or you can create a more complicated bat which will ask you which profile you want to start.

Hope it helps

Fxparlant

Fxp
Offline
Last seen: 13 years 3 months ago
Joined: 2008-03-07 10:44
multiple profiles bat file

you can create a dos file call it what you want (let say: firefox.bat) which will help you switch profiles, as long as you have created them as explained in the previous post:

Firefox.bat

@echo off
echo Which profile: 1, 2 or 3 ?
set /p Input=
if /i "%Input%"=="1" (goto Profile1)
if /i "%Input%"=="2" (goto Profile2)
if /i "%Input%"=="2" (goto Profile3)
REM if /i not "%Input%"=="y" (exit /b)
exit /b
:Profile1
copy /Y FirefoxPortableProfile1.ini FirefoxPortable.ini
FirefoxPortable
exit /b

:Profile2
copy /Y FirefoxPortableProfile2.ini FirefoxPortable.ini
FirefoxPortable
exit /b

:Profile3
copy /Y FirefoxPortableProfile3.ini FirefoxPortable.ini
FirefoxPortable
exit /b

Hope this helps.

Fxparlant

hutchinsfairy
Offline
Last seen: 2 years 8 months ago
Joined: 2008-08-15 07:51
More complicated bat file - simpler process

1. Amend folder structure as so:

-FirefoxPortable
    -App
    -Data
        -default
            -plugins
            -profile
            -settings
        -dev
            -plugins
            -profile
            -settings
        -light
            -plugins
            -profile
            -settings
    -Other

2. Put bat file in PortableFirefox folder and run!

3. (optional) place "Parameters.txt" in each new folder with a single line of command line parameters to pass to Firefox (e.g. -no-remote for dev profile).

.bat

@echo off
cls

:: Set MYPATH to Bat file directory
set MYPATH=%~dp0

:: Set the file where you profile list will be stored
set TMPTXT=%TMP%\FFprofiles_tmp.txt
:: Make sure it doesn't exist
if exist "%TMPTXT%" del "%TMPTXT%"


:: Store list of folders in \Data to FFprofiles_tmp.txt
dir "%MYPATH%Data" /AD /B /ON /P > "%TMPTXT%"

:SELECT
echo Available profiles:
echo.

setlocal enabledelayedexpansion
set choices=0
set i=0
for /f "usebackq delims=" %%a in ("%TMPTXT%") do (
set /a i+=1
set choices=!choices!,!i!
echo 	!i! %%a
)
set choices=%choices%,

echo.

set /p profile=Select by number (0 to exit):
if %profile%==0 goto END
if "%choices%"=="!choices:,%profile%,=!" (
echo Incorrect selection
pause
cls
goto SELECT
)


:RUN
set i=0
for /f "usebackq delims=" %%a in ("%TMPTXT%") do (
set /a i+=1
if !i!==%profile% set profile=%%a
)
echo Opening "%profile%" profile...

:: Check if FirefoxPortable.ini exists in current folder and copies from Other\source if not
if not exist "%MYPATH%FirefoxPortable.ini" copy /-Y "%MYPATH%Other\Source\FirefoxPortable.ini" "%MYPATH%FirefoxPortable.ini"

:: Start afresh with temp file
del "%TMPTXT%"

set params=
if exist "%MYPATH%Data\%profile%\Parameters.txt" set /P params=>"%TMPTXT%"
)

copy /Y "%TMPTXT%" "%MYPATH%FirefoxPortable.ini"

START /B .\FirefoxPortable.exe

:END
del "%TMPTXT%"
exit /B

EDIT: If you change the folder names of your new profiles after first run against that profile firefoxportable won't find your extensions properly...
Deleting .\Data\*folder*\profile\compatibility.ini and .\Data\*folder*\profile\extensions.ini after changing folder name seems to sort this out.

Fondary
Offline
Last seen: 12 years 6 days ago
Joined: 2009-11-13 17:22
Thank's ! There's also

Thank's !

There's also AndreasSeitz Portable profiles tool here: https://portableapps.com/node/5376#comment-112474

To whitch I propose some changes that make it work quite like the native FF profile manager :
https://portableapps.com/node/5376#comment-133358

fe1ix.th3.c4t
fe1ix.th3.c4t's picture
Offline
Last seen: 2 years 11 months ago
Joined: 2018-12-06 21:46
sorry for the necrophilia

but I faced a similar problem. I came across this topic, as well as an article on the site but the solutions offered there did not really fit me, so I did my own. I post it here in case anyone needs it.

1. Open FirefoxPortable\Data\settings\FirefoxPortableSettings.ini, change

LastProfileDirectory=NONE

then save it, and set ReadOnly attribute to this file.

2. Create FirefoxPortable\FirefoxPortable.global with the following content

[FirefoxPortable]
AllowMultipleInstances=true
DisableIntelligentStart=false

3. Create FirefoxPortable\load_profile.cmd with the following content

@echo off
@setlocal

if "%~1"=="" exit /b 2

set "profiles_path=Data"
set "lock_file=parent.lock"

for /f "usebackq tokens=* delims=" %%a in ('%~f0\..') do set "app_name=%%~na"

set "profile_name=%~1"
set "profile_path=%profiles_path%\%profile_name%"
set "profile_fullpath=%~dp0\%profile_path%"

if NOT "%profile_name:~0,2%" == "__" goto :skip_reset
call :check_profile_lock "%profile_fullpath%"
if NOT %errorlevel% EQU 0 exit /b %errorlevel%
>nul 2>&1 rd /s /q "%profile_fullpath%"
set "base_profile_name="
for /f "usebackq tokens=1,* delims=_" %%a in ('%profile_name%') do set "base_profile_name=%%b"
if "%base_profile_name%"=="" goto :no_base
set "base_profile_name=_%base_profile_name%"
set "base_profile_fullpath=%~dp0\%profiles_path%\%base_profile_name%"
call :check_profile_lock "%base_profile_fullpath%"
if NOT %errorlevel% EQU 0 exit /b %errorlevel%
>nul 2>&1 xcopy "%base_profile_fullpath%" "%profile_fullpath%" /s /e /c /i /q /g /h /r /k /y
:no_base
:skip_reset

>nul 2>&1 copy /y "%~dp0\%app_name%.global" "%~dp0\%app_name%.ini"
set "append_to_cfg=>>"%~dp0\%app_name%.ini" echo"
%append_to_cfg%.
%append_to_cfg%.ProfileDirectory=%profile_path%

start "" "%~dp0\%app_name%.exe"
exit /b 0

:check_profile_lock
@setlocal
set "profile_lock_file=%~1\%lock_file%"
if not exist "%profile_lock_file%" exit /b 0
>nul 2>&1 del /f /q /a "%profile_lock_file%"
if exist "%profile_lock_file%" exit /b 1
exit /b 0

4. Now create FirefoxPortable\%_PROFILE_NAME_%.cmd files (or just directly run FirefoxPortable\load_profile.cmd %_PROFILE_NAME_%) containing

@call "%~dp0\load_profile.cmd" "%~n0"

Examples
_heavy.cmd (begins with "_") - will load FF with FirefoxPortable\Data\_heavy profile
__clean.cmd (begins with "__") - will load FF with FirefoxPortable\Data\__clean profile, profile will be DELETED before loading each time. If profile is currently used by FF, script will do nothing.
__test_heavy.cmd (begins with "__", "_base_profile" appended after name) - will load FF with FirefoxPortable\Data\__test_heavy profile, profile will be DELETED and cloned from _heavy profile before loading each time. If profile is currently used by FF, script will do nothing. If original "base" profile is currently used by FF, script will also do not run (but profile will be already cleaned).

Also you can use "load_profile.cmd _heavy", "load_profile.cmd __clean", "load_profile.cmd __test_heavy"

Profile name started with "_", because filename started with "_" are in the top of the list.

P.S. I hope this will be useful to someone.
P.P.S. sorry for the bad English. I'm Russian and I'm drunk (^_^) so the text is translated by Yandex.

John T. Haller
John T. Haller's picture
Online
Last seen: 59 min 30 sec ago
AdminDeveloperModerator
Joined: 2005-11-28 22:21
Easiest (and Supported) Way

The easiest way, and the way we support multiple profiles without needing multiple full installs of Firefox Portable, is with the Second Profile tool: https://portableapps.com/support/firefox_portable#second_profile

You can install multiple copies, rename them as you'd like in the PA.c Platform, and the platform will even keep the profile tool up to date in all copies as long as you follow the naming convention in the link.

Sometimes, the impossible can become possible, if you're awesome!

Log in or register to post comments