11

Is it possible to make QGIS 3 portable with changed location for Qgis setup parameters folder.

For QGIS 2 it looked like this in qgis.bat file:

qgis --optionspath "X:\qgis" --configpath "X:\qgisini"

For QGIS 3 it doesn't work. Setup parameters are default placed in:

C:\Users\xxx\AppData\Roaming\QGIS

3
  • You can do a tutoriel to convers the QGIS 3.0.2 on a portable version ? I read this explenation : sigterritoires.fr/index.php/en And you suggest that the difference is in the build of qgis.dat ? Best regards
    – qgisuser
    Commented Apr 26, 2018 at 15:12
  • A big problem seems to be paths with spaces. It is not possible to specify a relative path with spaces after "--profiles-path". Does anyone know this problem? Commented Jun 26, 2019 at 10:44
  • Welcome to GIS SE! Could you please provide further context and a solution to your answer? You may otherwise add comments to the question.
    – root676
    Commented Jun 26, 2019 at 11:02

5 Answers 5

10

Those parameters have been removed in favour of the new --profiles-path option. You can set this to the root folder that will contain the profiles for the sessions

--profiles-path C:\temp\myqgisprofiles\

On Windows make a shortcut to the qgis-bin.exe and attach the parameter to the 'target' field.

This will make

C:\temp\myqgisprofiles\profiles\default

When run the first time.

Profiles are a new feature in QGIS 3 to keep settings and plugins, etc isolated from each other.

1
  • It's my last line in qgis.bat file below but QGIS still reads settings from ...AppData\Roaming with warnings: Unable to load C:\qgis-bin.exe Unable to load C:\QGIS3.0\bin\--profile-path. A part of my qgis.bat start "QGIS" /B "%OSGEO4W_ROOT%"\bin\qgis-bin.exe --profile-path "%OSGEO4W_ROOT%"\myqgisprofiles %*
    – Artec
    Commented Apr 1, 2018 at 17:08
4

The given option in the above answer is incorrect (profile instead of profiles) - the correct option is:

--profiles-path C:\temp\myqgisprofiles\

You can see the complete list of command line options of QGIS by running it in the command shell using the command line option --help:

qgis-bin.exe --help

(Running QGIS 3.0.2)

BTW: I don't have enough reputation yet, to add this as a comment to the answer above ...

1
  • It doesn't work for me. Still ini files are stored in ...AppData\Roaming\OGIS3,not in `C:\temp\myqgisprofiles` link to my qgis.bat
    – Artec
    Commented May 14, 2018 at 17:16
2

In the same place of the file OSGeo4W.bat, create a bat file with the instructions:

@echo off
call OSGeo4W.bat make-bat-for-py
call OSGeo4W.bat o4w_env
call OSGeo4W.bat py3_env
call OSGeo4W.bat qt5_env
call OSGeo4W.bat qgis --profiles-path %OSGEO4W_ROOT%\Profiles\

To this point, I have not been able to execute grass scripts, but work fine SAGA and GDAL

If want use Grass script edit the file grass74.bat

in the text:

SET OSGEO4W_ROOT=@osgeo4w@

with the text:

SET OSGEO4W_ROOT=%OSGEO4W_ROOT%
1
  • please place your code in code blocks for readability.
    – Dowlers
    Commented May 30, 2018 at 16:20
1

It seems "--profiles-path" option is enabled in case of using with "--profiles-name" .

example in bat file

start "QGIS" /B "%OSGEO4W_ROOT%"\bin\qgis-bin.exe
 --profiles-path "%OSGEO4W_ROOT%\settings" --profiles-name default
1
  • Still the same problem, QGIS profile folder was created in ...AppData\Roaming
    – Artec
    Commented Jul 10, 2018 at 21:04
1

This batch seems to work, adding a /qgisconfig directory in the current one to store QGIS config :

set DRV_LTR=%~dp0

REM set a specific Qgis variable with a variable setting before
set OSGEO4W_ROOT=%DRV_LTR%qgis

REM add a new path to the system path
path %PATH%;%OSGEO4W_ROOT%\apps\qgis-ltr\bin;%OSGEO4W_ROOT%\apps;%OSGEO4W_ROOT%\bin

REM if the bat file find one argument (project name), open it. Else open a Qgis program with a new empty project
if "%1" == "" (start "QGIS" /B %OSGEO4W_ROOT%\bin\qgis.bat --profiles-path %DRV_LTR%qgisconfig) else (start "QGIS" /B %OSGEO4W_ROOT%\bin\qgis-ltr.bat --profiles-path %DRV_LTR%qgisconfig --project %1)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.