0

I wish to spawn a command line in windows 10 to run QGIS with a project file included on the command line. The approach given in early QGIS 2.x docs of using ....qgis.exe -- project "myproject" does not work on my system (w10 up to date with QGIS 3.16) - probably to be expected given changes, but I can not find either a list of V3.x command line options or guidance on running QGIS from the command line in the V3.x docs.

Are these options still supported in V3.x and if so where are they documented?

1

2 Answers 2

2

Running qgis --help (or full/path/to/qgis --help if the QGIS bin directory isn't in your path) in a terminal/command prompt will give you the available command line parameters. Note from the below that the --project projectfile is an accepted parameter.

These command line parameters are in the documentation under section 9. QGIS Configuration (9.6.1. Command line and environment variables)

I just tested using QGIS 3.26.2 (on Linux) and it worked fine and loaded the specified project. If it does not work for you, please edit your question to provide more detail, such as exactly how you are trying to run the qgis --project projectfile command and what does happen when you run it.

qgis --help
QGIS is a user friendly Open Source Geographic Information System.
Usage: qgis [OPTION] [FILE]
  OPTION:
    [-v, --version] display version information and exit
    [-s, --snapshot filename]   emit snapshot of loaded datasets to given file
    [-w, --width width] width of snapshot to emit
    [-h, --height height]   height of snapshot to emit
    [-l, --lang language]   use language for interface text (changes existing override)
    [-p, --project projectfile] load the given QGIS project
    [-e, --extent xmin,ymin,xmax,ymax]  set initial map extent
    [-n, --nologo]  hide splash screen
    [-V, --noversioncheck]  don't check for new version of QGIS at startup
    [-P, --noplugins]   don't restore plugins on startup
    [-B, --skipbadlayers]   don't prompt for missing layers
    [-C, --nocustomization] don't apply GUI customization
    [-z, --customizationfile path]  use the given ini file as GUI customization
    [-g, --globalsettingsfile path] use the given ini file as Global Settings (defaults)
    [-a, --authdbdirectory path] use the given directory for authentication database
    [-f, --code path]   run the given python file on load
    [-d, --defaultui]   start by resetting user ui settings to default
    [--hide-browser]    hide the browser widget
    [--dxf-export filename.dxf] emit dxf output of loaded datasets to given file
    [--dxf-extent xmin,ymin,xmax,ymax]  set extent to export to dxf
    [--dxf-symbology-mode none|symbollayer|feature] symbology mode for dxf output
    [--dxf-scale-denom scale]   scale for dxf output
    [--dxf-encoding encoding]   encoding to use for dxf output
    [--dxf-map-theme maptheme]  map theme to use for dxf output
    [--take-screenshots output_path]    take screen shots for the user documentation
    [--screenshots-categories categories]   specify the categories of screenshot to be used (see QgsAppScreenShots::Categories).
    [--profile name]    load a named profile from the users profiles folder.
    [-S, --profiles-path path]  path to store user profile folders. Will create profiles inside a {path}\profiles folder 
    [--version-migration]   force the settings migration from older version if found
    [--openclprogramfolder]     path to the folder containing the sources for OpenCL programs.
    [--help]        this text
    [--]        treat all following arguments as FILEs

  FILE:
    Files specified on the command line can include rasters, vectors,
    QGIS layer definition files (.qlr) and QGIS project files (.qgs and .qgz): 
     1. Rasters - supported formats include GeoTiff, DEM 
        and others supported by GDAL
     2. Vectors - supported formats include ESRI Shapefiles
        and others supported by OGR and PostgreSQL layers using
        the PostGIS extension
0

Its possible that the startup parameters are still available, but im not 100% sure on that, nor can I find the doco to support this.

What i do know is that you could configure startup parameters inside of a python startup.py file.

This documentation on how these work can be found here.

https://docs.qgis.org/3.22/en/docs/pyqgis_developer_cookbook/intro.html

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.