9

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

  • 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 Apr 26 '18 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? – Stephan Büttig Jun 26 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 Jun 26 at 11:02
8

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.

  • 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 Apr 1 '18 at 17:08
  • there is a typo in the answer. it's --profiles-path – markgraeflerland Jul 20 '18 at 10:21
2

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 ...

  • 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 May 14 '18 at 17:16
1

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%
  • please place your code in code blocks for readability. – Dowlers May 30 '18 at 16:20
0

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
  • Still the same problem, QGIS profile folder was created in ...AppData\Roaming – Artec Jul 10 '18 at 21:04
0

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, privacy policy and cookie policy

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