How to make a “QGIS on a stick” implementation

Posted on Updated on

Some months ago I found this interesting article  “” about how to create a classroom setup of QGIS. I tried the solution and had some mixed results using it. Sometimes QGIS failed in the processing module and sometimes it simply wouldn’t start.

If you ask yourself: “And so what ? Why not do an ordinary install of QGIS ?” – You haven’t (as I have) been in a out-of-town computer-lab with 24 computers –  all with non working or not existing QGIS setups and off-course  no IT personnel with local administrator rights nearby and 15 minutes until the first pupils arrive.
After that, you most certainly know what I’m talking about !! computerlab

The problem is that QGIS installation process copies some general support dll’s into the windows directory if they are missing before the actual QGIS install.

If you simply follow the dutch article and copy the qgis directory to another computer – without the support dlls installed beforehand – then QGIS probably fail under startup. Sometimes QGIS works though, because some other program already has installed the general support dll’s into the windows directory beforehand.

The solution was to find which general support dll’s that QGIS uses and copy them to a directory included the QGIS installation. This directory has to be part of the “path” statement for the QGIS startup. There is one obvious candidate for this: The directory ..\apps\qgis\bin where  a number of support dll’s for QGIS already resides.

And voila !! After copying the relevant files to this directory QGIS works on every computer I’ve made with this special installation on.

Disclaimer: It works for me and all the different use cases I tried. That’s not the same as it will work for every one every time on every windows pc!!

This is how to make a “QGIS on a stick” installation. Or any other place you want to use QGIS without doing an actual installation.

  1. Install QGIS using a normal network install ( into a directory of your choice. Default is “c:\osgeo4w” for 32 bit QGIS or “c:\osgeo4w64” for 64 bit. This directory is called “<install-dir>” from now on.  The installation is used as a blueprint for future installations.
  2. Edit the file: <install-dir>\bin\qgis.bat with a simple text editor like notepad:Change the line (It’s probably the last line in the file):
    start “QGIS” /B “%OSGEO4W_ROOT%”\bin\qgis-bin.exe %*
    start “QGIS” /B “%OSGEO4W_ROOT%”\bin\qgis-bin.exe –configpath “%OSGEO4W_ROOT%”\qgisini %*
    and save the result.
  3. Create a new emty directory: <install-dir>\qgisini. This directory is a replacement for all the stuff normally placed in the .qgis2 directory in the users home director and all the qgis entries in the registry.
  4. Now you have to copy some system files:If you have installed a QGIS 32 bit program on a 32 bit windows or a QGIS 64 bit program on a 64 bit windows then:

    the files msvcp100.dll and msvcr100.dll from directory c:\windows\system32 to directory <install-dir>\apps\qgis\bin

    If you have installed a QGIS 32 bit program on a 64 bit windows then:copy the files msvcp100.dll and msvcr100.dll from directory c:\windows\syswow64 to directory <install-dir>\apps\qgis\bin.
  5. Start QGIS by doubleclicking on file <install-dir>\bin\qgis.bat. First time it starts you’ll get a load of python errors when you start. It might even crash QGIS. That’s expected – just terminate QGIS and restart by doubleclicking on the same qgis.bat. This time it will work.
  6. Now you can copy the <install-dir> to any device … on a memory-stick, a network drive, to another pc without qgis.


NB! Don’t change the internal ordering of the directory and files in the copied directory. Although you may change the main directory name from ex. c:\osgeo4w to c:\qgis (or whatever).

NB! the change in the start command (–configpath parameter) makes every user share the same setup for QGIS. If one user changes something in the setup, ex. another language, this change will be present for every user on the same pc. I will probably write a short article on how to make a optimal QGIS network installation with every user having her/his own setup for QGIS at a later timer.

Make all the wanted changes to the normal QGIS setup, for example a new default projection, language selection, install extra plugins and so on into the original <install-dir> QGIS. The changes will be registered and collected into the <install-dir>\qgisini directory, which is a part of the directory structure that afterwards is distributed together with the QGIS binaries.

TIP: After you have copied the <install-dir> to another drive, you can create a short-cut to qgis.bat and place the short-cut in the root directory of the new drive or on the desktop. Then start QGIS by double-clicking on the short-cut.



This was easy ! If you want to have a common network-install of QGIS on a network-drive, but have individual setup for every user, you can do the following:

  1. Do all the stuff that the article mentions.
  2. When you edit the qgis.bat then change the line:

    start “QGIS” /B “%OSGEO4W_ROOT%”\bin\qgis-bin.exe %*

    start “QGIS” /B “%OSGEO4W_ROOT%”\bin\qgis-bin.exe –configpath “%APPDATA%”\qgisini %*

    start “QGIS” /B “%OSGEO4W_ROOT%”\bin\qgis-bin.exe –configpath “%OSGEO4W_ROOT%”\qgisini %*
    as previously written)

  3. And: Insert a new line in the qgis.bat just before the start… command:

    if not exist “%APPDATA%”\qgisini\*.* xcopy “%OSGEO4W_ROOT%”\qgisini “%APPDATA%”\qgisini /e /i >nul

  4. Copy the <install-dir> to a network-drive

That’s it ! First time a new user starts QGIS the command will silently copy the standard setup to the users private “appdata” directory and QGIS will use this setup.

BoEnjoy !!

Bo Victor Thomsen