Tell me please, how can I get current version of installed QGIS from command line (batch-file). QGIS installed with Osgeo4w-installer.

Registry search did not return any result.


Unfortunately I am not good enough with Windows batch files or Power shell scripts but I can show where the OSGeo4W installer is storing that info. It can be found from the temp directory that is used for caching the downloaded packages before installation. The location is by default something like


The http part in the path name is the URL of the mirror that was used when the installer was run. The file to look at is setup.ini and it contains a section for each installed item.

@ qgis
sdesc: "QGIS Desktop"
ldesc: "QGIS Desktop"
category: Desktop
requires: qgis-common python3-core pyqt5 python3-gdal gpsbabel python3-psycopg2 python3-qscintilla python3-jinja2 python3-markupsafe python3-pygments python3-python-dateutil python3-pytz python3-future python3-requests python3-pyproj python3-pyyaml python3-plotly python3-owslib python3-httplib2 python3-nose2 python3-mock qt5-qml exiv2 qt5-tools
version: 3.14.16-2
install: x86_64/release/qgis/qgis/qgis-3.14.16-2.tar.bz2 49937472 b203a2993cff9783d3bb9565126a0700
version: 3.14.16-1
install: x86_64/release/qgis/qgis/qgis-3.14.16-1.tar.bz2 49942698 14ef4259f23d1b67be8f82189d7e0b70

The challenge for the script-writers is simply "Find string @ GIS. It must be exact match to avoid lines like @ qgis-dev. Probably there are no white spaces on the line but I am not sure. Alternatively find sdesc: "QGIS Desktop"). The version is on the 6th line of the block.

I would love to see this solved with awk but unfortunately it does not come with Windows.

  • thanks for the answer. But here's my situation. I'm going to install QGIS using osgeo4w from dowloaded files to a shared folder on local network (not internet). And I want to check the version of the installed QGIS on computers before installing (updating). I also cannot figure out how the last installed version of the program is launched when I click *.qgs- and *.qgz-files. I didn't see any mention in the environment variables, in the registry too. – johnzet Oct 28 '20 at 15:09
  • OSGeo4W starts QGIS by running qgis.bat in the \bin directory. It runs whatever qgis-bin.exe that it finds from the search path. @echo off call "%~dp0\o4w_env.bat" call qt5_env.bat call py3_env.bat @echo off path %OSGEO4W_ROOT%\apps\qgis\bin;%PATH% set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis set GDAL_FILENAME_IS_UTF8=YES rem Set VSI cache to be used as buffer, see #6448 set VSI_CACHE=TRUE set VSI_CACHE_SIZE=1000000 set QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qgis\qtplugins;%OSGEO4W_ROOT%\apps\qt5\plugins start "QGIS" /B "%OSGEO4W_ROOT%\bin\qgis-bin.exe" %* – user30184 Oct 28 '20 at 15:38
  • Yes, I understand, how qgis starts of course. I dont understand, how qgis starts, when I doubleclick on project file file.qgs from desktop, for example. When I install 2 versions of qgis on the computer, how system understand, that it should be runned last installed version qgis. Where system hold variables for this. – johnzet Oct 28 '20 at 16:18
  • 1
    Registry settings are in the directory c:\OSGeo4W64\apps\qgis\bin (on my computer), in file qgis.req. There is a key [HKEY_CLASSES_ROOT\QGIS Project\Shell\open\command] @="\"C:\\OSGEO4~1\\bin\\qgis.bat\" \"%1\"". So QGIS project is opened with qgis.bat that starts the binary that has a fixed name and location start "QGIS" /B "%OSGEO4W_ROOT%\bin\qgis-bin.exe" %*. And registry is edited with some post-install batch file magic. See qgis.bat.done that you have in OSGeo4W64\etc\postinstall. Keys seem to be for the ROOT user. – user30184 Oct 28 '20 at 17:24
  • Thanks for help! I'm going to continue looking for a way to get the current version of qgis with the cmd :) – johnzet Oct 28 '20 at 18:04

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.